-
Notifications
You must be signed in to change notification settings - Fork 7
/
08_03_treeParents.ttl
93 lines (88 loc) · 4.41 KB
/
08_03_treeParents.ttl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
@base <http://www.openphacts.org/api#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix uniprot: <http://purl.uniprot.org/core/> .
@prefix api: <http://purl.org/linked-data/api/vocab#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix ops: <http://www.openphacts.org/api#> .
@prefix dcterms: <http://purl.org/dc/terms/>.
<#tree> a api:API ;
rdfs:label "Concept Class Hierarchies"@en ;
api:sparqlEndpoint <http://alpha.openphacts.org:8890/sparql/> ;
api:contentNegotiation api:parameterBased ;
api:variable <#input> ;
api:dataset <http://www.ebi.ac.uk/chembl> ;
api:dataset <http://purl.uniprot.org/enzyme/> ;
api:vocabulary rdfs: ;
api:vocabulary skos: ;
api:vocabulary uniprot: ;
api:description "An API configuration to return information about concept class based on hierarchical structures. Currently supported hierarchies are the BioAssay Ontology, Enzyme Classification, the ChEMBL Target Tree, the ChEBI ontology, the Human Disease Ontology and the Gene Ontology" ;
api:endpoint [
a api:ItemEndpoint ;
api:name "Hierarchies: Parent Nodes" ;
api:description "A representation of all parent nodes of the given class in the supportted hierarchies. The BioAssay Ontology, ChEBI Ontology, the Gene Ontology, the Enzyme Classification, the ChEMBL Target Tree, and the Human Disease Ontology are currently supported." ;
api:itemTemplate "{uri}" ;
api:variable <http://purl.uniprot.org/enzyme> ;
api:variable <http://www.ebi.ac.uk/chembl/target> ;
api:variable <http://www.ebi.ac.uk/chebi> ;
api:variable <http://www.geneontology.org> ;
api:uriTemplate "/tree/parents?uri={uri}" ;
api:exampleRequestPath "/tree/parents?uri=http%3A%2F%2Fpurl.uniprot.org%2Fenzyme%2F6.2.-.-";
api:viewer <#treeParentViewer> ;
api:defaultViewer <#treeParentViewer> ] .
<http://www.ebi.ac.uk/chembl> api:label "ChEMBL - RDF" .
<http://purl.uniprot.org/enzyme/> api:label "Enzyme Classification" .
<http://www.ebi.ac.uk/chebi> api:label "ChEBI" .
<http://www.geneontology.org> api:name "Gene Ontology" .
<http://www.ebi.ac.uk/chembl/target> api:name "chembl" .
<http://purl.uniprot.org/enzyme> api:name "enzyme" .
<http://www.ebi.ac.uk/chebi> api:name "chebi" .
<http://www.geneontology.org> api:name "go" .
<#input> api:name "uri" ;
api:label "uri";
api:value "A class URI from one of the supported hierarchies. e.g.: http://purl.uniprot.org/enzyme/6.2.-.-" ;
rdfs:range rdfs:Resource .
<#treeParentViewer> a api:Viewer ;
api:name "treeParentViewer";
api:template "
?ops_item skos:exactMatch ?node_uri .
?node_uri ops:parentNode ?parent_node ;
skos:prefLabel ?label ;
void:inDataset ?g_short .
?parent_node skos:prefLabel ?parent_label ;
skos:prefLabel ?parent_name .
<http://purl.uniprot.org/enzyme> skos:prefLabel 'Enzyme Classification' .
<http://www.ebi.ac.uk/chembl/target> skos:prefLabel 'ChEMBL Target Hierarchy' .
<http://www.ebi.ac.uk/chebi> skos:prefLabel 'ChEBI Ontology' .
<http://www.geneontology.org> skos:prefLabel 'GeneOntology' .
<http://www.bioassayontology.org> skos:prefLabel 'BioAssayOntology' .
<http://purl.obolibrary.org/obo/doid> skos:prefLabel 'Human Disease Ontology' .
";
api:where "{
SELECT DISTINCT ?parent_node ?node_uri ?g_short WHERE {
VALUES ?g {
<http://purl.uniprot.org/enzyme/direct>
<http://www.ebi.ac.uk/chembl/target/direct>
<http://www.ebi.ac.uk/chebi/direct>
<http://www.geneontology.org>
<http://www.bioassayontology.org>
<http://purl.obolibrary.org/obo/doid>
}
GRAPH ?g {
?node_uri rdfs:subClassOf ?parent_node .
FILTER ( isURI(?parent_node) )
BIND (IF(?g = <http://purl.uniprot.org/enzyme/direct>, <http://purl.uniprot.org/enzyme> ,
IF(?g = <http://www.ebi.ac.uk/chembl/target/direct>, <http://www.ebi.ac.uk/chembl/target> ,
IF(?g = <http://www.ebi.ac.uk/chebi/direct>, <http://www.ebi.ac.uk/chebi> ,
IF(?g = <http://www.geneontology.org>, <http://www.geneontology.org> ,
IF(?g = <http://www.bioassayontology.org>, IRI(<http://www.bioassayontology.org>) ,
IF(?g = <http://purl.obolibrary.org/obo/doid>, IRI(<http://purl.obolibrary.org/obo/doid>), 'Error')))))) AS ?g_short )
}
}
}
OPTIONAL { { ?node_uri rdfs:label ?label }
UNION { ?node_uri skos:prefLabel ?label }
}
OPTIONAL { ?parent_node rdfs:label ?parent_label }
OPTIONAL { ?parent_node skos:prefLabel ?parent_name }
MINUS { ?parent_node uniprot:obsolete true }
" .