Hello,
I am new to Jena, and to the semantic space as well.
I am trying to build an application using Jena and I am encountering
some issues.
I built the Ontology using the Ontology APIs. It all looks good, and I
can use a reasoner to get information out.
I then generate the XML doc representing the Ontology. I can also use
Protege to visualize the ontology.
So far so good.
The problem comes when I try to use SPARQL. When i use the query "
?subject rdfs:subClassOf ?object " it works fine. However if i try to
use something to the effect of: "?subject rdfs:subclassOf product:Food"
I get nothing (I am trying to get all the classes that are subclasses of
Food), and there are many subclasses of Food declared. I have attached
the generated XML Ontology.
If however I use OWL-DL (DL-Query in Protege) or in code, it works fine
i.e. I get the necessary subclasses.
So my question is what am I doing wrong ? Is the way the graph is stored
in XML causing the problem for SPARQL, or am I misunderstanding the way
to use the SPARQL query ?
Any insight or guidance would be greatly appreciated
regards,
Bruno
P.S. I had a look at the Wine ontology that is publicly available, and I
noticed that in the XML doc, that Sub Classes are referred to by "resource"
, whereas in the "Product" graph that I generate, they are referred to
by "ID". Could that be a problem ? And if it is what do I need to use in
the APIs to rectify this ?
I am new to Jena, and to the semantic space as well.
I am trying to build an application using Jena and I am encountering
some issues.
I built the Ontology using the Ontology APIs. It all looks good, and I
can use a reasoner to get information out.
I then generate the XML doc representing the Ontology. I can also use
Protege to visualize the ontology.
So far so good.
The problem comes when I try to use SPARQL. When i use the query "
?subject rdfs:subClassOf ?object " it works fine. However if i try to
use something to the effect of: "?subject rdfs:subclassOf product:Food"
I get nothing (I am trying to get all the classes that are subclasses of
Food), and there are many subclasses of Food declared. I have attached
the generated XML Ontology.
If however I use OWL-DL (DL-Query in Protege) or in code, it works fine
i.e. I get the necessary subclasses.
So my question is what am I doing wrong ? Is the way the graph is stored
in XML causing the problem for SPARQL, or am I misunderstanding the way
to use the SPARQL query ?
Any insight or guidance would be greatly appreciated
regards,
Bruno
P.S. I had a look at the Wine ontology that is publicly available, and I
noticed that in the XML doc, that Sub Classes are referred to by "resource"
, whereas in the "Product" graph that I generate, they are referred to
by "ID". Could that be a problem ? And if it is what do I need to use in
the APIs to rectify this ?