On 18/01/13 16:26, Fabio Aiub Sperotto wrote:
Hi,
I have a doubt.
*I have this fragment:*
<owl:ObjectProperty rdf:ID="Cultiva">
<rdfs:domain>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<owl:Class rdf:about="#conceptA"/>
<owl:Class rdf:about="#conceptB"/>
<owl:Class rdf:about="#conceptC"/>
</owl:unionOf>
</owl:Class>
</rdfs:domain>
</owl:ObjectProperty>
*And I'm using this SPARQL:*
SELECT * { ontoPrefix:Cultiva rdfs:domain ?domain }
*The result are:*
_______________________________
| domain |
|______________________________|
| conceptA or conceptB or conceptC |
------------------------------------------------------
All in a single line in my ontology editor.
*In jena*, with ResultSet, I receive this:
( ?domain = _:b0 )
Is there a way to get the concepts in a table (one row for each concept)
with SPARQL? Or list in Jena?
Paul has shown you how to do this in SPARQL.
Jena also provides a convenience API for working with ontologies:
http://jena.apache.org/documentation/ontology/
In particular if you have your property as an OntProperty then you can
use sequences like
prop.getDomain().asClass().asUnionClass().listOperands()
to get the domain as a UnionClass and iterate over the members of the union.
Dave