You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across a Stack Overflow question where the poster was looking
to retrieve annotation property axioms from an ontology in the
Protege's SPARQL tab [1]. Evidently (see the comments on that
question), the SPARQL query didn't work in the tab, but worked in
external tools. In earlier message (from January 2014) Tim Redmond
mentioned that another issue with the tab might result from Protege
querying against an intermediate representation (the whole message,
for context, is included after my message):
But I am wondering if this issue comes up because of the fact that the query
is sensitive to the way that the OWL file is encoded as RDF. The current
SPARQL query plugin works by
taking the owl ontology in memory and writing it as RDF in the form of an
in-memory sesame model.
using the sesame query tools to make the query.
In particular the original OWL as RDF file is not used for the query.
Is the current issue with querying for annotation properties a result
of the same behavior? In this case, I'd think that since annotation
axioms are part of OWL, they probably should be available for query
through SPARQL.
//JT
[1] http://stackoverflow.com/q/24598087/1281433
On Tue, Jan 14, 2014 at 2:13 AM, Timothy Redmond <tredmond@stanford.edu> wrote:
So I think that the query in question is
prefix : <http://stackoverflow.com/q/21092246/1281433/data.owl#>
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 ?superclass where {
:A (rdfs:subClassOf|(owl:intersectionOf/rdf:rest*/rdf:
first))* ?superclass .
filter(!isBlank(?superclass))
}
run against the attached owl file. Interestingly when I tried this I got a
result including A, B and C.
But I am wondering if this issue comes up because of the fact that the query
is sensitive to the way that the OWL file is encoded as RDF. The current
SPARQL query plugin works by
taking the owl ontology in memory and writing it as RDF in the form of an
in-memory sesame model.
using the sesame query tools to make the query.
In particular the original OWL as RDF file is not used for the query. I can
imagine that the class expression
B
and C
and (p some D)
might be expressible in RDF with two owl:intersectionOf expressions.
Perhaps this is what happened in your in-memory sesame model. But I am not
sure why this would happen exactly.
-Timothy.
On 01/13/2014 11:33 AM, Joshua TAYLOR wrote:
Sorry, I ended up editing that answer. The version that I originally
mentioned was
http://stackoverflow.com/revisions/21093154/2
However, the updated version,
http://stackoverflow.com/revisions/21093154/3
show some similar issues, and compares the output against's Jena's.
In case the answer gets edited any more, I'll include the query and
sample data here. Here's a simple ontology with an axiom
A subClassOf (B and C and (p some D))
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns="http://stackoverflow.com/q/21092246/1281433/data.owl#">
<owl:Ontology
rdf:about="http://stackoverflow.com/q/21092246/1281433/data.owl"/>
<owl:Class
rdf:about="http://stackoverflow.com/q/21092246/1281433/data.owl#C"/>
<owl:Class
rdf:about="http://stackoverflow.com/q/21092246/1281433/data.owl#B"/>
<owl:Class
rdf:about="http://stackoverflow.com/q/21092246/1281433/data.owl#A">
<rdfs:subClassOf>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class
rdf:about="http://stackoverflow.com/q/21092246/1281433/data.owl#B"/>
<owl:Class
rdf:about="http://stackoverflow.com/q/21092246/1281433/data.owl#C"/>
<owl:Restriction>
<owl:onProperty>
<owl:ObjectProperty
rdf:about="http://stackoverflow.com/q/21092246/1281433/data.owl#p"/>
</owl:onProperty>
<owl:someValuesFrom>
<owl:Class
rdf:about="http://stackoverflow.com/q/21092246/1281433/data.owl#D"/>
</owl:someValuesFrom>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</rdfs:subClassOf>
</owl:Class>
</rdf:RDF>
Using Jena, this query
prefix : <http://stackoverflow.com/q/21092246/1281433/data.owl#>
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 ?superclass where {
:A (rdfs:subClassOf|(owl:intersectionOf/rdf:rest*/rdf:first))* ?superclass
.
}
produces this output:
--------------
| superclass |
==============
| :A |
| _:b0 |
| :B |
| :C |
| _:b1 |
--------------
Now, I realize that Protege will typically do something prettier with
the blank nodes (in this case, it ought to show (B and C and (p some
D)) and (p some D) ). However, I actually only get the results A and
B, as shown in http://i.stack.imgur.com/bv7xm.png .
On Mon, Jan 13, 2014 at 1:02 PM, Joshua TAYLOR <joshuaaaron@gmail.com>
wrote:
Hello all,
I just answered a question on StackOverflow [1] wherein I ran into a
small ontology (posted in completeness there) where three SPARQL
queries that I'd thought should have returned the same results return
different results. My answer [2] to the question includes the
ontology and the queries, as well as screenshots. The long and short
of it is that trying to select some subclasses *(those in a direct
rdfs:subClassOf path, modulo owl:equivalentClass links) of :C with
this query
?subclass (^owl:equivalentClass|(owl:equivalentClass|rdfs:subClassOf))*
:C
works just fine. However, a seemingly equivalent query
(rdfs:subClass|owl:equivalentClass|^owl:equivalentClass)*
returns different results, and another
(owl:equivalentClass|^owl:equivalentClass|rdfs:subClass)*
returns different results from the first two.
If this isn't a known bug already, it's probably not too hard to
pinpoint exactly what's happening (using a different example and three
distinct properties), but I haven't done that yet.
Does this look like a bug, or have I misread the property path syntax?
//JT
[1] http://stackoverflow.com/q/21092246/1281433
[2] http://stackoverflow.com/a/21093154/1281433
--
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
The text was updated successfully, but these errors were encountered:
From the mailing list:
The text was updated successfully, but these errors were encountered: