我是SPARQL的新手。我正在尝试运行此查询 -
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT * FROM <http://purl.obolibrary.org/obo/merged/DOID> WHERE {
?nodeID owl:annotatedSource <http://purl.obolibrary.org/obo/DOID_11330>.
#?nodeID rdf:type owl:Annotation.
?nodeID owl:annotatedProperty ?annotatedProperty.
?nodeID owl:annotatedTarget ?annotatedTarget.
?nodeID ?aaProperty ?aaPropertyTarget.
OPTIONAL {?annotatedProperty rdfs:label ?annotatedPropertyLabel}.
OPTIONAL {?aaProperty rdfs:label ?aaPropertyLabel}.
FILTER (isLiteral(?annotatedTarget)).
FILTER (not exists {?aaProperty in(owl:annotatedSource, rdf:type, owl:annotatedProperty, owl:annotatedTarget)
})}
- 但我收到了这个错误,我不知道该怎么做。请帮我。感谢。
Encountered " "in" "in "" at line 13, column 41.
Was expecting one of:
<IRIref> ...
<PNAME_NS> ...
<PNAME_LN> ...
<VAR1> ...
<VAR2> ...
"a" ...
"distinct" ...
"multi" ...
"shortest" ...
"(" ...
"!" ...
"^" ...
答案 0 :(得分:4)
NOT EXISTS需要图形模式。你想要的可能是(只是猜到)
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT *
FROM <http://purl.obolibrary.org/obo/merged/DOID>
WHERE
{ ?nodeID owl:annotatedSource <http://purl.obolibrary.org/obo/DOID_11330> .
?nodeID owl:annotatedProperty ?annotatedProperty .
?nodeID owl:annotatedTarget ?annotatedTarget .
?nodeID ?aaProperty ?aaPropertyTarget
OPTIONAL
{ ?annotatedProperty rdfs:label ?annotatedPropertyLabel}
OPTIONAL
{ ?aaProperty rdfs:label ?aaPropertyLabel}
FILTER isLiteral(?annotatedTarget)
FILTER ( ?aaProperty NOT IN (owl:annotatedSource, rdf:type, owl:annotatedProperty, owl:annotatedTarget) )
}