Hi Everybody
I m trying to use the software R with this OPS service?
Someone Know how is the authentification process?
i will be very grateful if someone help me
Thanks
USING SOFTWARE R TO OBTAIN PATENT INFORMATION FROM OPS
-
- Posts: 1298
- Joined: Thu Feb 22, 2007 5:32 pm
Re: USING SOFTWARE R TO OBTAIN PATENT INFORMATION FROM OPS
Dear user,
All needed OPS information can be found in OPS documentation:
http://www.epo.org/searching/free/ops/d ... ation.html
Regards,
OPS support
All needed OPS information can be found in OPS documentation:
http://www.epo.org/searching/free/ops/d ... ation.html
Regards,
OPS support
Re: USING SOFTWARE R TO OBTAIN PATENT INFORMATION FROM OPS
Hi serigasan,
It is defiantly possible. Have a peek here, the following code works:
The forum won't let me post the correct url-argument in the POST-function because it thinks it is spam. Be sure to add the abbrevation for HyperText Transfer Protocol Secure slash slash colon to the front of the url.
Happy hunting.
It is defiantly possible. Have a peek here, the following code works:
Code: Select all
#attach libs
libs <- c('httr', 'base64enc')
lapply(libs, require, character.only = TRUE)
#generate auth-credentials
key <- 'your_key-here'
sec_key <- 'your_secret_key_here'
auth_enc <- base64encode(charToRaw(paste0(key, ':', sec_key)))
heads <- c(auth_enc, 'application/x-www-form-urlencoded')
names(heads) <- c('Authorization', 'content-type')
#POST auth
auth <- POST(url = 'ops[dot]epo[dot]org[slash]3.1[slash]auth[slash]accesstoken', #READ BELOW
add_headers(heads), body = 'grant_type=client_credentials')
#you want to make sure that the request was sent successfully so access the response like so:
content(auth)
auth$status
Happy hunting.
Re: USING SOFTWARE R TO OBTAIN PATENT INFORMATION FROM OPS
Thanks Majo
I obtain the Access token but when i put it in the url i dont know what is happen
Can someone help me?
I m using these Url:
OPENPATENTSERVICE URL/rest-services/published-data/search/biblio/?q=thermoanaerobacter&oauth2_access_token=Bearer_XXXXX"
Which is my mistake?
I obtain the Access token but when i put it in the url i dont know what is happen
Can someone help me?
I m using these Url:
OPENPATENTSERVICE URL/rest-services/published-data/search/biblio/?q=thermoanaerobacter&oauth2_access_token=Bearer_XXXXX"
Which is my mistake?
Re: USING SOFTWARE R TO OBTAIN PATENT INFORMATION FROM OPS
It looks like that you are trying to pass the token while getting the data you want. You don't need to do that.
Shoud suffice. Remember that you could specify the query further like so:
If you want to search for 'thermoanaerobacter' in the Title tag for instance.
Hope this helps.
Code: Select all
OPENPATENTSERVICE URL/rest-services/published-data/search/biblio/?q=thermoanaerobacter
Code: Select all
OPENPATENTSERVICE URL/rest-services/published-data/search/biblio/?q=ti%3Dthermoanaerobacter
Hope this helps.
-
- Posts: 1298
- Joined: Thu Feb 22, 2007 5:32 pm
Re: USING SOFTWARE R TO OBTAIN PATENT INFORMATION FROM OPS
Great help, thak you Mayo.
I only wanted to point out that our CQL search without field identifier will automatically search all text fields in biblio of a patent document. In patent terminology, biblio would represent all information of the first page of most patent documents (those who comply to WIPO st). So, it will search names, titles and when available also abstracts. If you use numers, then date fields will be included too. When you want to search in any specific field, use identifiers like "ti" for title. List of all available identifiers can also be found in Espacenet Help files. OPS Register services uses different field identifiers, available also in European Register Help files on our website.
I would like to thank all that share their technical knowledge and experience with other users. Your practical knowledge is very valuable to others and especially to us who offer this service but are not end users of the system and no real IT, or web services experts.
So thank you again and please continue sharing your knowledge, expertice and your feedback with our OPS user community and with us.
Regards,
OPS support
I only wanted to point out that our CQL search without field identifier will automatically search all text fields in biblio of a patent document. In patent terminology, biblio would represent all information of the first page of most patent documents (those who comply to WIPO st). So, it will search names, titles and when available also abstracts. If you use numers, then date fields will be included too. When you want to search in any specific field, use identifiers like "ti" for title. List of all available identifiers can also be found in Espacenet Help files. OPS Register services uses different field identifiers, available also in European Register Help files on our website.
I would like to thank all that share their technical knowledge and experience with other users. Your practical knowledge is very valuable to others and especially to us who offer this service but are not end users of the system and no real IT, or web services experts.
So thank you again and please continue sharing your knowledge, expertice and your feedback with our OPS user community and with us.
Regards,
OPS support
-
- Posts: 2
- Joined: Fri Mar 27, 2015 8:47 am
Re: USING SOFTWARE R TO OBTAIN PATENT INFORMATION FROM OPS
Dear Majo,
Very many thanks for posting this. It is incredibly helpful. However, I have a different question on how to handle the response object returned from OPS in R.
library(httr)
library(XML)
thermo <- POST("..../rest-services/published-data/search/biblio/?q=ti%3Dthermoanaerobacter", content_type("plain/text"), add_headers("Authorization", "BearerToken", "xxx"), accept_xml())
The return is
>class(thermo)
[1] "response"
>head(thermo)
displays the output and content (as $content [1] 3c 21 44 4f 43 etc.) up to 5276 rows.
In the httr package the answer seems to be to use content() to extract the content of the response.
t <- content(thermo)
t ## prints html
class(t)
[1] "HTMLInternalDocument" "HTMLInternalDocument" "XMLInternalDocument" "XMLAbstractDocument"
The problem is how to access this content. After many hours of experimenting with the XML package I am at a loss. I guess the problem is that the examples out there assume a single html or xml page to parse. Any advice gratefully received. It may be something very obvious. I will post a full solution here if I find it to assist others. Kind regards, Paul
Very many thanks for posting this. It is incredibly helpful. However, I have a different question on how to handle the response object returned from OPS in R.
library(httr)
library(XML)
thermo <- POST("..../rest-services/published-data/search/biblio/?q=ti%3Dthermoanaerobacter", content_type("plain/text"), add_headers("Authorization", "BearerToken", "xxx"), accept_xml())
The return is
>class(thermo)
[1] "response"
>head(thermo)
displays the output and content (as $content [1] 3c 21 44 4f 43 etc.) up to 5276 rows.
In the httr package the answer seems to be to use content() to extract the content of the response.
t <- content(thermo)
t ## prints html
class(t)
[1] "HTMLInternalDocument" "HTMLInternalDocument" "XMLInternalDocument" "XMLAbstractDocument"
The problem is how to access this content. After many hours of experimenting with the XML package I am at a loss. I guess the problem is that the examples out there assume a single html or xml page to parse. Any advice gratefully received. It may be something very obvious. I will post a full solution here if I find it to assist others. Kind regards, Paul
-
- Posts: 2
- Joined: Fri Mar 27, 2015 8:47 am
Re: USING SOFTWARE R TO OBTAIN PATENT INFORMATION FROM OPS
As a follow up to my earlier question. The problem was indeed obvious in the end. The authentication solution kindly provided by Majo works very well. The problem in my case seemed to be two fold.
1. The access token generated after authentication timing out and needing to be refreshed.
2. The POST method (see page 9 of the documentation) not working (for me at least). However GET works fine.
The problem in my case was that it seemed to have worked in terms of generating the kind of objects that I was expecting (but actually hadn't worked).
When experimenting in R it is a good idea to go to the OPS developers area and test the request in the API console (developers.epo.org) at the same time. This provides a good idea of whether there is a problem with your query construction at the OPS end or a problem with your code in R.
I am presently working on the WIPO Manual on Open Source Patent Analytics and will post more details on working with OPS data in R as the manual develops.
Kind regards,
Paul
1. The access token generated after authentication timing out and needing to be refreshed.
2. The POST method (see page 9 of the documentation) not working (for me at least). However GET works fine.
The problem in my case was that it seemed to have worked in terms of generating the kind of objects that I was expecting (but actually hadn't worked).
When experimenting in R it is a good idea to go to the OPS developers area and test the request in the API console (developers.epo.org) at the same time. This provides a good idea of whether there is a problem with your query construction at the OPS end or a problem with your code in R.
I am presently working on the WIPO Manual on Open Source Patent Analytics and will post more details on working with OPS data in R as the manual develops.
Kind regards,
Paul