USPTO / PatentPublicData

Utility tools to help download and parse patent data made available to the public
Other
186 stars 80 forks source link

No idea how to start at all #76

Open George85413 opened 5 years ago

George85413 commented 5 years ago

Hi, I really appreciate this site for helping with the data. And I am very sorry to raise the question below. But can the author provide some simple guide how to run these files in Eclipse IDE at all? I am a rookie for Java and just not sure what the following even means. Such as

gov.uspto.bulkdata.cli2.BulkData

options:
  --type=application               Data type: [grant, application, gazette]
  --date="20140101-20161231"       Single date range or comma seperated list of date ranges
  --limit=0
  --skip=0
  --outdir="../download"
  --async=false
  --filename="ipa140109.zip"

How do I run this command in Eclipse IDE at all?

Again, I am very sorry to bring this naive question.

mustberuss commented 5 years ago

I'm not an author but I'll take a shot. I built and ran the provided code from a windows command prompt but you can run in eclipse if you want. Here's one way to do that:

  1. Clone the repository or download and expand the zip file. Either way the project's code will wind up on your local machine.
  2. In eclipse create a new workspace.
  3. Right click in the Package Explorer pane and select "Import->Maven->Existing Maven Project". Navigate to where the code from step 1 wound up. Make sure that the "Add project(s) to working set" is checked. You should see something like this
     /pom.xml gov.uspto:PatentPubliData:n.n.n-SNAPSHOT:pom
        BulkDownloader/pom.xml gov.uspto:BulkDownloader:n.n.n-SNAPSHOT:pom
        PatentDocument/pom.xml gov.uspto:PatentDocument:n.n.n-SNAPSHOT:pom
        Common/pom.xml gov.uspto:Common:n.n.n-SNAPSHOT:pom

Make sure everything is selected and then press Finish. If you have "Project->Build automatically" checked you should be ready to go, otherwise do a "Project->Build All".

To run BulkData expand BulkDownloader in the Package Explorer pane and continue to expand folders until you see BulkData.java in the gov.uspto.bulkdata.cli2 package. Right click on it and select "Run as -> java application". In the console pane you are supposed to see the usage statement you pasted into your question. Instead, you'll get an exception saying a required parameter is missing. The class is marked deprecated so it probably won't get fixed. Now repeat the right click and this time select "Run as -> Run configurations" You can then set any of the program arguments for that application.

Ex. if you want to pull down a zip file of granted patent xml data you could paste the following into the Program arguments tab:

--type=grant
--date="20150512-20150512"
--outdir="/downloads"

Then press the apply button and then the run button. The console pane should fill with output as the program runs. The requested data should appear in the outdir you specified, provided that the directory exists before you pressed the run button. You can run any of the java files that have a main method. The README.md files mention the classnames and show the arguments they accept. Just find and run the corresponding java file with the arguments you want and you should be all set.

George85413 commented 5 years ago

Thanks for the reply! But I am still getting quite a lot error codes. Please see below. Any help is greatly appreciated!

Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at java.base/sun.security.ssl.Alerts.getSSLException(Alerts.java:198) at java.base/sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1974) at java.base/sun.security.ssl.Handshaker.fatalSE(Handshaker.java:345) at java.base/sun.security.ssl.Handshaker.fatalSE(Handshaker.java:339) at java.base/sun.security.ssl.ClientHandshaker.checkServerCerts(ClientHandshaker.java:1968) at java.base/sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1777) at java.base/sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:264) at java.base/sun.security.ssl.Handshaker.processLoop(Handshaker.java:1098) at java.base/sun.security.ssl.Handshaker.processRecord(Handshaker.java:1026) at java.base/sun.security.ssl.SSLSocketImpl.processInputRecord(SSLSocketImpl.java:1137) at java.base/sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1074) at java.base/sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) at java.base/sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1402) at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1429) at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413) at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:319) at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:283) at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:168) at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257) at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135) at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254) at okhttp3.RealCall.execute(RealCall.java:92) at gov.uspto.bulkdata.PageLinkScraper.fetchPage(PageLinkScraper.java:46) at gov.uspto.bulkdata.PageLinkScraper.fetchPageLinks(PageLinkScraper.java:72) at gov.uspto.bulkdata.PageLinkScraper.fetchLinks(PageLinkScraper.java:206) at gov.uspto.bulkdata.cli2.BulkData.fetchLinks(BulkData.java:160) at gov.uspto.bulkdata.cli2.BulkData.fetchLinks(BulkData.java:167) at gov.uspto.bulkdata.cli2.BulkData.download(BulkData.java:84) at gov.uspto.bulkdata.cli2.BulkData.main(BulkData.java:308) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385) at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:290) at java.base/sun.security.validator.Validator.validate(Validator.java:264) at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:343) at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:226) at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:133) at java.base/sun.security.ssl.ClientHandshaker.checkServerCerts(ClientHandshaker.java:1947) ... 36 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141) at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126) at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297) at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380) ... 42 more

mustberuss commented 5 years ago

@George85413 from the exception it looks like your computer doesn't trust the uspto's https certificate, Googling the first line of the exception turns up this at stackoverlow, which doesn't look easy to fix.

You could try running Download to see if it will work for sites other than uspto.gov