@prefix ex: <https://sparql.uniprot.org/.well-known/sparql-examples/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <https://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix spex:<https://purl.expasy.org/sparql-examples/ontology#> .

ex:42 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Connect patents cited in UniProtKB with those in the patent database at EPO via publication number."@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """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 ?citation ?patent ?application ?applicationNo
WHERE
{
  ?citation a up:Patent_Citation ;
    skos:exactMatch ?patent .
  FILTER(CONTAINS(STR(?patent), 'EP'))
  BIND(SUBSTR(STR(?patent), 35) AS ?applicationNo)
  SERVICE <https://data.epo.org/linked-data/query>{
    ?application patent:publicationNumber ?applicationNo
  }
}""" ;
    schema:keywords "EPO" , "cross-reference" , "entry history" , "patent" , "federated query" ;
    schema:target <https://sparql.uniprot.org/sparql/> ;
    spex:federatesWith <https://data.epo.org/linked-data/query> .

