-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathget_target.sparql
36 lines (34 loc) · 1.34 KB
/
get_target.sparql
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
#+ endpoint: https://api.krr.triply.cc/datasets/mkumpel/FruitCuttingKG/services/FoodCuttingKG/sparql
#+ summary: Query the target for the specific verb. This is either the food itself or a specific shape/part like Halve or Slice
#+ tags:
#+ - object to cut
# Query the target for the specific verb. This is either the food itself or a specific shape/part like Halve or Slice
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX soma: <http://www.ease-crc.org/ont/SOMA.owl#>
PREFIX cut: <http://www.ease-crc.org/ont/food_cutting#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?res WHERE {
{
${verb} rdfs:subClassOf* ?inter_node.
?inter_node owl:intersectionOf ?in_res_node.
?in_res_node rdf:first ?input_node.
?input_node owl:onProperty cut:hasInputObject.
?input_node owl:someValuesFrom ?target.
FILTER NOT EXISTS {
?target owl:unionOf ?union_node.
}
BIND(REPLACE(STR(?target), "^.*[#/]", "") AS ?res).
}
UNION
{
${verb} rdfs:subClassOf* ?inter_node.
?inter_node owl:intersectionOf ?in_res_node.
?in_res_node rdf:first ?input_node.
?input_node owl:onProperty cut:hasInputObject.
?input_node owl:someValuesFrom ?targets_node.
?targets_node owl:unionOf ?union_node.
?union_node rdf:first ?target.
BIND(REPLACE(STR(?target), "^.*[#/]", "") AS ?res).
}
}