On Fri, Jan 18, 2013 at 11:26 AM, Fabio Aiub Sperotto
<[email protected]>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.
>
Ontology aware systems are able to work with these structures for you,
which is why you get a union as a result ("or" expresses a union).
> *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?
>
In raw SPARQL (which Jena is giving you above), you need to ask for the
entire structure, which is a list. The structural definition is in:
http://www.w3.org/TR/2012/REC-owl2-mapping-to-rdf-20121211/
A union is represented with:
_:x *owl:unionOf* T(SEQ DR1 ... DRn) .
Your query is retrieving the blank node, but you'll need the list. Try this:
SELECT ?domain ?class {
ontoPrefix:Cultiva rdfs:domain ?domain .
?domain owl:unionOf ?list .
?list rdf:rest*/rdf:first ?class }
(I haven't run this myself, but I think it's right....)
Paul