Great,

That worked thx a bundle.

Now for a short  follow-up question:

1) what would the SPARQL query look like to get all the classes that have a certain property of a certain value

I would like to have a "Base Class" (i.e. Product) that has a certain value (Product.ClassCounter) that all other classes "inherit" from.
As things get added to the Ontology this counter get incremented.

I would like to be able to query the ontology for all the classes that have a ClassCounter value "of greater than X " for instance ?

Any hints would be greatly appreciated.

regards,

Bruno


On 14-10-21 11:07 AM, Jean-Marc Vanel wrote:
>From 10000m heigth, a likely cause is an error in  the prefix product: .

Anyway, unless you have a special reason to use XML ,
it's better to use Turtle format all the way.

2014-10-21 16:53 GMT+02:00 Bruno Baloi <[email protected]>:

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 ?





Reply via email to