1 year ago
#230891

Yu Gu
Negation does not work as expected for SPARQL property paths
According to SPARQL Property Paths, negation is expressed with the operator !
, i.e., !(a|b|c|d)
means any relations that do not fall into {a, b, c, d}
.
Based one this definition, I find the following example very counterintuitive.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://rdf.freebase.com/ns/>
ASK {
:m.0262dl9
!(:type.object.type|<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>)
:common.topic
}
The above query returns false
because the only relations from :m.0262dl9
to :common.topic
are :type.object.type
and <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
, which are negated. However, if we add ^:type.object.type
, which means the inverse of :type.object.type
to the negated set, the answer becomes true
. In other words, we modify
!(:type.object.type|<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>)
to
!(:type.object.type|^:type.object.type|<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>)
This is quite weird, since the first query is false entails that the second query must also be false. I am really not sure why the second query returns true
. Am I misunderstanding the definition of !
or ^
?
sparql
rdf
freebase
0 Answers
Your Answer