Date: 2012-08-07 17:47:50 From: dhavalkumar.thakker@gmail.com Dear List members I was looking for a way to use SPARQL to find out direct super or subclasses of a concept. I can see that SPARQL new features document mentions this under "property paths" http://www.w3.org/TR/sparql-features/#Property_paths As it seems to be still working draft, hence long shot but has OWLIM got support for this? Or are there any alternative to it (may be through custom properties)? Apologies if the question is already addressed somewhere else, in which case I will appreciate a pointer to the discussions/solution. Many thanks -- Regards Dhaval Dr. Dhaval Thakker

asked 03 Apr '13, 10:45

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%


Date: 2012-09-24 08:03:01
From: barry.bishop@ontotext.com
Hello Stefano,
This is a quite an open question. I suggest you have a look at this:
http://www.w3.org/TR/sparql11-query/#construct
Best of luck,
barry
Barry Bishop
OWLIM Product Manager
Ontotext AD
link

answered 03 Apr '13, 10:46

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

Date: 2012-08-07 20:50:05
From: sinan.yurtsever@atosresearch.eu
Dear Dhaval
As far as I know SPARQL 1.1 (therefore OWLIM) supports property paths
and you can query OWLIM with SPARQL queries. Although it is not within
my knowledge if property paths allow retrieving direct subclasses or
superclasses of a class.
On the other hand OWLIM enables querying only explicit statements which
may help you retrieving the direct (sub/super)classes that you need. The
link below explains this feature (for the most recent version of
OWLIM-SE):
http://owlim.ontotext.com/display/OWLIMv52/OWLIM-SE+Query+Behaviour#OWLI
M-SEQueryBehaviour-ManagingExplicitandImplicitStatements
I hope I was able to answer your question to some degree.
Best Regards,
Sinan Yurtsever
Sinan Yurtsever
Research Engineer
Research & Innovation
link

answered 03 Apr '13, 10:45

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

Date: 2012-08-07 21:53:12
From: barry.bishop@ontotext.com
Hi Dhaval,
OWLIM does indeed support property paths, however, this is not 
particularly helpful in this case. What you actually want to do is to 
check for adjacent elements in a transitive property chain, in this case 
rdfs:subClassOf.
The way I would normally do this is to describe a subclass relationship 
and allow for an optional 'inbetween' class, then check that this 
'inbetweener' is not bound, e.g. to find the direct superclass of 
my:Concept (allowing for the fact that under RDFS semantics all classes 
are subclasses of themselves):
SELECT ?super {
BIND( my:Concept as ?concept )
?concept rdfs:subClassOf ?super .
OPTIONAL {
?concept rdfs:subClassOf ?inbetweener .
?inbetweener rdfs:subClassOf ?super .
FILTER( ?inbetweener != ?concept && ?inbetweener != ?super )
}
FILTER( ! BOUND(?inbetweener) && ?super != ?concept)
}
I hope this helps,
barry
Barry Bishop
link

answered 03 Apr '13, 10:45

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

Date: 2012-08-08 11:06:23
From: dhavalkumar.thakker@gmail.com
Thanks Barry
It works
regards
Dhaval
link

answered 03 Apr '13, 10:45

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

Date: 2012-08-08 13:43:23
From: Luciano.Blasetti@fao.org
That's good.
I wonder why these very useful "magic" predicates like sesame:directSubClassOf as well as sesame:directType are not mentioned in the OWLIM documentation although they seems to work fine.
Can we rely on them? Do you see any drawbacks in using them?
Kind regards,
Luciano
link

answered 03 Apr '13, 10:45

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

From: sielski@man.poznan.pl
Hi,
I saw 'direct' plugin being initialized at startup along with other 
OWLIM plugins for special (or 'magic') predicates. We used it 
particularly for sesame:directType predicate and it worked well although 
it was slightly slower than quering only materialized statements (which 
was a problem only in some complex queries).
-- 
Best regards,
Krzysztof Sielski
link

answered 03 Apr '13, 10:45

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

Date: 2012-08-08 16:40:30
From: damyan@sirma.bg
Hi,
using sesame:directType, sesame:directSubClassOf and 
sesame:directSubPropertyOf is better at lest because it does not skip 
the classes that are part of subsumption loops (e.g. mutually 
equivalentClasses)
also sometimes you may have a more specific class membership inferred 
due to the specifics of the ontology (for instance through domain or 
range of a property or some weird interplay between restriction 
definitions and class subsumprions) so simply by looking up on the 
explicit statements may not be sufficient.
As an example of handling loops in the classes hierarchy, consider 
following example data:
<urn:c> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <urn:d> .
<urn:d> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <urn:e> .
<urn:e> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <urn:d> .
<urn:f> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <urn:d> .
<urn:g> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <urn:f> .
<urn:inst1> a <urn:c> .
<urn:inst2> a <urn:e> .
<urn:inst3> a <urn:f> .
<urn:inst4> a <urn:g> .
Then try to lookup for the direct type of the urn:inst2 - the generic 
way of checking for it will skip both urn:d and urn:e because there will 
be always a class 'inbetween' ...
-------------------
select * {
BIND( <urn:inst2> as ?i )
?i <http://www.openrdf.org/schema/sesame#directType> ?c .
}
-------------------
or at the difference between the results of these queries (the first one 
is that Barry proposed few emails down in the thread used to 'show' the 
generic way):
-------------------
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
SELECT ?super {
BIND( <urn:c> as ?concept )
?concept rdfs:subClassOf ?super .
OPTIONAL {
?concept rdfs:subClassOf ?inbetweener .
?inbetweener rdfs:subClassOf ?super .
FILTER( ?inbetweener != ?concept && ?inbetweener != ?super )
}
FILTER( ! BOUND(?inbetweener) && ?super != ?concept)
}
-------------------
and the one that make use of our Direct plugin...
-------------------
select * {
BIND( <urn:c> as ?i )
?i <http://www.openrdf.org/schema/sesame#directSubClassOf> ?c .
}
-------------------
About the missing documentation - I was really surprised that we didn't 
even mention it - we have if from ages in our codebase (since Sesame 1 
where there were even dedicated methods to handle it)
best,
Damyan Ognyanov
Ontotext AD
link

answered 03 Apr '13, 10:46

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

Date: 2012-09-17 15:17:04
From: sedano87@hotmail.it
Hello,
about the direct superclasses, is there a way to specify the relationship for a set of superclasses. 
Suppose i have 3 classes in my ontology where A isSubClassOf B and B isSubClassOf C, i wanna query my owlim server to get all the superclasses of A, so I want to have as result B and C, but also a way to understand that B is sub class of C, so i can build again my ontology's tree. Is there a way to do that using sparql?
Thanks,
Best,
Stefano
link

answered 03 Apr '13, 10:46

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

Date: 2012-09-17 16:35:28
From: barry.norton@ontotext.com
Sorry to jump in (hope I'm not missing something obvious), but you seem 
to be forcing a graph query into a relational (SELECT) answer. Don't you 
just want to do a CONSTRUCT query and navigate the subgraph?
Barry
link

answered 03 Apr '13, 10:46

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

Date: 2012-09-17 17:32:30
From: sedano87@hotmail.it
Probably,
i'm sorry for that but i'm quite new in sparql query and i don't know to much about construct stantement. Can you show me an example query?
Stefano
link

answered 03 Apr '13, 10:46

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

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

Tags:

×261
×242

Asked: 03 Apr '13, 10:45

Seen: 6,878 times

Last updated: 27 May, 07:10

powered by BitNami OSQA