-
Notifications
You must be signed in to change notification settings - Fork 7
/
12_03_patentGetEntities_Count.ttl
149 lines (136 loc) · 5.91 KB
/
12_03_patentGetEntities_Count.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
@base <http://www.openphacts.org/api> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix api: <http://purl.org/linked-data/api/vocab#> .
@prefix schembl: <http://rdf.ebi.ac.uk/terms/surechembl#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix ops: <http://www.openphacts.org/api#> .
@prefix void: <http://rdfs.org/ns/void#> .
<#patent> a api:API ;
rdfs:label "Patent"@en ;
api:sparqlEndpoint <http://alpha.openphacts.org:8890/sparql/> ;
api:contentNegotiation api:parameterBased ;
api:variable <#input> ;
api:variable schembl:SCCO_000028 ;
api:variable schembl:SCCO_000038 ;
api:variable _:type ;
api:variable _:title ;
api:variable _:abstract ;
api:variable _:description ;
api:variable _:claims ;
api:variable _:image ;
api:variable _:cwu ;
api:description "An API configuration to return information about patents" ;
api:endpoint [
a api:ItemEndpoint ;
api:name "Patent Entities: Count" ;
api:description "Returns the number of entities that are mentioned in the user specified patent.";
api:uriTemplate "/patent/entities/count?uri={uri}" ;
api:itemTemplate "{uri}" ;
api:variable <http://rdf.ebi.ac.uk/terms/surechembl#SCCO_000010> ;
api:variable <http://rdf.ebi.ac.uk/terms/surechembl#SCCO_000035> ;
api:variable <http://rdf.ebi.ac.uk/terms/surechembl#SCCO_000036> ;
api:exampleRequestPath "/patent/entities/count?uri=http%3A%2F%2Frdf.ebi.ac.uk%2Fresource%2Fsurechembl%2Fpatent%2FEP-1339685-A2";
api:viewer <#patentEntitiesCountViewer> ;
api:defaultViewer <#patentEntitiesCountViewer> ] .
<#input> api:name "uri" ;
api:label "uri";
api:value "A patent URI. e.g.: http://rdf.ebi.ac.uk/resource/surechembl/patent/EP-1339685-A2" ;
rdfs:range rdfs:Resource .
schembl:SCCO_000028 api:name "score" ;
api:label "score" ;
api:filterVariable "?assoc" ;
api:value "Only return entities mentioned in the patent whose relevance score is equal to this number. An integer between 0 and 3." ;
a rdf:Property .
schembl:SCCO_000038 api:name "frequency" ;
api:label "frequency" ;
api:filterVariable "?assoc" ;
api:value "Only return entites mentioned in the patent with frequency equal to this number. A positive integer." ;
a rdf:Property .
_:type api:name "entity_type" ;
api:label "entity_type" ;
api:filterVariable "?entity_type" ;
api:value "Only return entities of the specified type (and are mentioned in the patent). One of: 'molecule', 'target', 'disease'." ;
rdfs:subPropertyOf api:graphFilter ;
a rdf:Property .
_:title api:name "title" ;
api:label "title" ;
api:filterVariable "?title_occ" ;
api:value "If set to 'true' the method returns only entities mentioned in the title of the patent." ;
rdfs:subPropertyOf api:graphFilter ;
a rdf:Property .
_:abstract api:name "abstract" ;
api:label "abstract" ;
api:filterVariable "?abstract_occ" ;
api:value "If set to 'true' the method returns only entities mentioned in the abstract of the patent." ;
rdfs:subPropertyOf api:graphFilter ;
a rdf:Property .
_:description api:name "description" ;
api:label "description" ;
api:filterVariable "?desc_occ" ;
api:value "If set to 'true' the method returns only entities mentioned in the description section of the patent." ;
rdfs:subPropertyOf api:graphFilter ;
a rdf:Property .
_:claims api:name "claims" ;
api:label "claims" ;
api:filterVariable "?claims_occ" ;
api:value "If set to 'true' the method returns only entities mentioned in the claims section of the patent." ;
rdfs:subPropertyOf api:graphFilter ;
a rdf:Property .
_:image api:name "image" ;
api:label "image" ;
api:filterVariable "?image_occ" ;
api:value "If set to 'true' the method returns only entities in an image in the patent." ;
rdfs:subPropertyOf api:graphFilter ;
a rdf:Property .
_:cwu api:name "cwu" ;
api:label "cwu" ;
api:filterVariable "?cwu_occ" ;
api:value "If set to 'true' the method returns only entities mentioned in a CWU of the patent." ;
rdfs:subPropertyOf api:graphFilter ;
a rdf:Property .
<http://rdf.ebi.ac.uk/terms/surechembl#SCCO_000010> api:name "molecule" .
<http://rdf.ebi.ac.uk/terms/surechembl#SCCO_000035> api:name "target" .
<http://rdf.ebi.ac.uk/terms/surechembl#SCCO_000036> api:name "disease" .
<#patentEntitiesCountViewer> a api:Viewer ;
api:name "patentEntitiesCountViewer" ;
api:template
"
?patent_uri ops:entityCount ?count ;
void:inDataset <http://www.ebi.ac.uk/surechembl> .
" ;
api:where
"
{ SELECT DISTINCT ?patent_uri ( COUNT ( ?entity ) AS ?count ) WHERE {
GRAPH <http://www.ebi.ac.uk/surechembl> {
?patent_uri a schembl:SCCO_000002 ;
schembl:SCCO_000007 ?date .
OPTIONAL {
?patent_uri schembl:SCCO_000005 ?title_res .
?title_res schembl:SCCO_000030 ?title ;
schembl:SCCO_000031 'EN' .
}
OPTIONAL {
?assoc schembl:SCCO_000020 ?patent_uri ;
schembl:SCCO_000021 ?entity ;
schembl:SCCO_000028 ?rel_score ;
schembl:SCCO_000038 ?freq .
?entity a ?entity_type .
OPTIONAL { ?assoc schembl:SCCO_000022 ?desc_occ_tmp }
OPTIONAL { ?assoc schembl:SCCO_000023 ?title_occ_tmp }
OPTIONAL { ?assoc schembl:SCCO_000024 ?claims_occ_tmp }
OPTIONAL { ?assoc schembl:SCCO_000025 ?abstract_occ_tmp }
OPTIONAL { ?assoc schembl:SCCO_000026 ?image_occ_tmp }
OPTIONAL { ?assoc schembl:SCCO_000027 ?cwu_occ_tmp }
OPTIONAL { ?entity schembl:SCCO_000037 ?entity_name }
OPTIONAL { ?entity schembl:SCCO_000017 ?entity_smiles }
}
BIND ( IF( ?desc_occ_tmp = true, true, false ) AS ?desc_occ )
BIND ( IF( ?title_occ_tmp = true, true, false ) AS ?title_occ )
BIND ( IF( ?claims_occ_tmp = true, true, false ) AS ?claims_occ )
BIND ( IF( ?abstract_occ_tmp = true, true, false ) AS ?abstract_occ )
BIND ( IF( ?image_occ_tmp = true, true, false ) AS ?image_occ )
BIND ( IF( ?cwu_occ_tmp = true, true, false ) AS ?cwu_occ )
}
} }
".