@prefix ex:<https://purl.expasy.org/sparql-examples/neXtProt/> .
@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:NXQ_00267 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Proteins binding estradiol and/or similar molecules (similarity search with SMILES), and their associated GO_MF terms"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX : <http://nextprot.org/rdf/>
PREFIX cco: <http://rdf.ebi.ac.uk/terms/chembl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sachem: <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>


SELECT distinct ?entry (group_concat(distinct str(?gomflab); SEPARATOR = ",") as ?gomfx) WHERE {
 		SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/idsm> {
 		SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/cco> {
 		?compound sachem:similarCompoundSearch [ sachem:query "CC12CCC3C(C1CCC2O)CCC4=C3C=CC(=C4)O" ] . # smiles chain for estradiol
		 }
		 		?ACTIVITY rdf:type cco:Activity;
		cco:hasMolecule ?compound;
 cco:hasAssay ?ASSAY.
		 ?ASSAY cco:hasTarget ?TARGET.
		 ?TARGET cco:taxonomy <http://identifiers.org/taxonomy/9606> . # human protein target
		 ?TARGET cco:hasTargetComponent ?COMPONENT.
		 ?COMPONENT cco:targetCmptXref ?UNIPROT.
		 filter(contains(str(?UNIPROT),"uniprot"))
		 }
	?entry skos:exactMatch ?UNIPROT.
	?entry :isoform ?iso.
	?iso :goMolecularFunction / :term ?gomf .
	?gomf rdfs:label ?gomflab .
}
group by ?entry""" ;
    schema:keywords "federated query",
        "function",
        "similarity",
        "small molecule interaction",
        "tutorial" ;
    schema:target <https://sparql.nextprot.org/sparql> ;
    spex:federatesWith <https://idsm.elixir-czech.cz/sparql/endpoint/idsm> ,
        <https://idsm.elixir-czech.cz/sparql/endpoint/cco> .

