SPARQL examples for the EMI
View the Project on GitHub earth-metabolome-initiative/sparql-examples
Connect patents cited in UniProtKB with those in the patent database at EPO via publication number, whose grant date is more than twenty years in the past.
PREFIX patent: <http://data.epo.org/linked-data/def/patent/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX up: <http://purl.uniprot.org/core/>
SELECT ?grantDate ?patent ?application ?applicationNo
WHERE
{
?citation a up:Patent_Citation ;
skos:exactMatch ?patent .
BIND(SUBSTR(STR(?patent), 35) AS ?applicationNo)
BIND(SUBSTR(STR(?patent), 33, 2) AS ?countryCode)
SERVICE <https://data.epo.org/linked-data/query>{
?publication patent:publicationNumber ?applicationNo ;
patent:application ?application .
?application patent:grantDate ?grantDate .
}
BIND((year(now()) - 20) AS ?thisYearMinusTwenty)
BIND(year(?grantDate) AS ?grantYear)
FILTER(?grantYear < ?thisYearMinusTwenty)
} ORDER BY ?grantYear
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?application"):::projected
v5("?applicationNo"):::projected
v3("?citation")
v6("?countryCode")
v9("?grantDate"):::projected
v10("?grantYear")
v4("?patent"):::projected
v7("?publication")
v10("?thisYearMinusTwenty")
c2(["up:Patent_Citation"]):::iri
f0[["?grantYear < ?thisYearMinusTwenty"]]
f0 --> v10
f0 --> v10
v3 --"a"--> c2
v3 --"skos:exactMatch"--> v4
bind1[/"substring(str(?patent),'35^^xsd:integer')"/]
v4 --o bind1
bind1 --as--o v5
bind2[/"substring(str(?patent),'33^^xsd:integer','2^^xsd:integer')"/]
v4 --o bind2
bind2 --as--o v6
subgraph s1["https://data.epo.org/linked-data/query"]
style s1 stroke-width:4px;
v7 --"patent:publicationNumber"--> v5
v7 --"patent:application"--> v8
v8 --"patent:grantDate"--> v9
end
bind3[/"year-from-dateTime(NOW()) - '20^^xsd:integer'"/]
bind3 --as--o v10
bind4[/"year-from-dateTime(?grantDate)"/]
v9 --o bind4
bind4 --as--o v10