I have an ontology about Fruit. Here I classify a fruit as TropicalFruit class which only contain the fruits which are grows in Tropical Region. But In this class I do not add individuals but it contains individuals by inference. Now I want to access this TropicalFruit by sparql query in protege editor.

EDIT copied from answer:

I have found individual from PomeFruit class by this query where I add individual like Apple.

 SELECT * WHERE { ?individual a fruit:PomeFruit. }

But I can not found TropicalFruit by this query where by inference have Apple individual.

 SELECT * WHERE { ?individual a fruit:TropicalFruit. }

asked 07 Oct '12, 09:34

Md%20Mahedi%20Kaysar's gravatar image

Md Mahedi Ka...
accept rate: 0%

edited 08 Oct '12, 17:47

Signified's gravatar image

Signified ♦

It is protege 4.2 alpha. When I run FaCT++ reasoner TropicalFruit class contain some fruit individuals and show yellow background. I can use sampler query. I can find individuals from classes but in that class where I have add that individuals.I do not add individuals in TropicalFruit. But this type query does not work. SELECT ?tropfruit WHERE{ ?tropfruit rdf:type ex:TropicalFruit.}

(08 Oct '12, 13:00) Md Mahedi Ka... Md%20Mahedi%20Kaysar's gravatar image

The protege SPARQL tab does not seem to support inference at present. eg.

WHERE {?s rdfs:subClassOf ?p}

doesnt display that ex:TropicalFruit is a Thing. SPARQL is a new feature in this build. i would imagine that it will get inference support in later iterations.

One workaround would be to export the inferred triples and import them again.

Or you could load the ontology into a triplestore that supports inference and query from there.

(08 Oct '12, 14:04) Sweet Burlap Sweet%20Burlap's gravatar image

P.S. - try to post comments/replies to questions as comments/replies to the answer rather than as an answer itself.

Its a bit pedantic, but the voting system for answers can rank the answers - seperating semantically incorrect replies from the original comment - making it hard to decipher conversations (especially for outside observers) as it gets more complex.

(08 Oct '12, 14:11) Sweet Burlap Sweet%20Burlap's gravatar image

yap, I do not found TropicalFruit classes. I do not understand your suggestion. Please explain me, how can I export inferred triple or how can I load the ontology into a triplestore. What is triplestore? Give me some example.

(08 Oct '12, 14:15) Md Mahedi Ka... Md%20Mahedi%20Kaysar's gravatar image

Please, Give me suggestion how can I find all the inferred knowledge by sparql.

(08 Oct '12, 14:23) Md Mahedi Ka... Md%20Mahedi%20Kaysar's gravatar image

its clumsy but you can save the inferred axioms as its own ontology using File > Export inferred axioms as ontology > Select all axioms to export and > Select to include annotations and exported axioms - thsi will save the ontology (asserted and inferred) as a new ontology ie. "ex:Mango a ex:TropicalFruit" will behave as if you have explicitally declared it as such ie. materialisation.

(08 Oct '12, 14:38) Sweet Burlap Sweet%20Burlap's gravatar image

Triplestores are essentially databases optimised for triples (http://en.wikipedia.org/wiki/Triplestore), they tend to have varying degrees of inference support. Lots of choice - http://www.w3.org/2001/sw/wiki/Category:Triple_Store. Choice on cost, source availability, performance, inferencing capabilities, support etc. Stardog.com looks interesting - but havetn gotten around to testing it out yet

(08 Oct '12, 14:40) Sweet Burlap Sweet%20Burlap's gravatar image

I can export and find the inferred individuals in the individual list. But I can't access any individual from any classes as I can in previous and some others query are not working. the query "?Fruit a fruit:TropicalFruit" is not working. This query is not working in the other class also that I had find in the previous.

In the export ontology the reasoner is not working say reasoner is died. Is this the problem? But some queries are working.

(08 Oct '12, 16:35) Md Mahedi Ka... Md%20Mahedi%20Kaysar's gravatar image

the reasoner isn't the problem - I got the error too.

Did you check the export asserted axioms box?

another point is that Protege uses a different namespace for the inferred and asserted axioms eg. it uses the first ontology base uri for asserted axioms and the second ontology base uri for inferred - try "test:TropicalFruit" - or check the triples generated in a text editor (protege hiding the URIs isn't necessarily helpful)

(09 Oct '12, 14:25) Sweet Burlap Sweet%20Burlap's gravatar image

Thanks a lot. I have got all individuals from the all types of classes. I uses same namespace for the previous ontology and for export ontology but you said, protege uses a different namespace for the inferred and asserted axiom. I don't understand.

When I export the 1st ontology then occurs a problem when I check the disjoint classes Axioms to export. And cannot export this totally. Why this types of problem occurs?

(11 Oct '12, 06:07) Md Mahedi Ka... Md%20Mahedi%20Kaysar's gravatar image
showing 5 of 10 show 5 more comments

Which version of protege are you running?

If you run the inference in Protege do you get individuals in the TropicalFruit Class? (Show in yellow background in Protege 4)

What are you using for SPARQL queries - SPARQL tab in Protege 3 or a plugin in Protege 4

Have you been able to issue simpler SPARQL queries eg. select all / select all instances of Fruit? eg.

?s ?p ?o.}

SELECT ?fruit
?fruit rdf:type ex:Fruit.}

If you have inferencing capabilities, you should be able to issue a simple

SELECT ?tropfruit
?tropfruit rdf:type ex:TropicalFruit.}
permanent link

answered 07 Oct '12, 11:46

Sweet%20Burlap's gravatar image

Sweet Burlap
accept rate: 18%

edited 07 Oct '12, 12:14

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 07 Oct '12, 09:34

question was seen: 4,491 times

last updated: 20 Jan, 15:55