Re: question on UNION

[second try, missed to define subject]

Hi, Paul!

Paul Hermans wrote on Mon, 4 Jun 2007:

> Given
>
> PREFIX pcce: <http://www.pcce.be/egb/>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> PREFIX owl: <http://www.w3.org/2002/07/owl#>
> SELECT ?property ?object ?value

BTW: It would have been nice to also post an example RDF graph. Below, you find my own, which I created and tested with Topbraid Composer.

> This works
> WHERE
> {?subject ?property ?object.
> ?property a owl:ObjectProperty.
> ?object rdfs:label ?value}

Yes.

> This works also
> WHERE {
> {?subject ?property ?object.
> ?property a owl:DataProperty}

This results in an empty list, because there is no 'owl:DataProperty' in OWL, only a 'owl:DatatypeProperty'.

> But the union only returns object properties (everything before the
> union) in this case
>
> WHERE {
> {?subject ?property ?object.
> ?property a owl:ObjectProperty.
> ?object rdfs:label ?value}
> UNION
> {?subject ?property ?object.
> ?property a owl:DataProperty} }
>
>
> And only data properties (before the union) in this case

Not true, you again only get object properties. Due to the misnamer 'DataProperty'.

> WHERE {
> {?subject ?property ?object.
> ?property a owl:DataProperty}
> UNION
> {?subject ?property ?object.
> ?property a owl:ObjectProperty.
> ?object rdfs:label ?value} }
>
>
> While I would like to have both.

Rename 'DataProperty' to 'DatatypeProperty'. This should give you all results.

Cheers,
Michael


=========== example RDF ================

<?xml version="1.0"?>
<rdf:RDF
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:owl="http://www.w3.org/2002/07/owl#"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
   xmlns="http://www.example.org/unnamed0.owl#"
   xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
 xml:base="http://www.example.org/unnamed0.owl">
 <owl:Ontology rdf:about="">
   <owl:versionInfo rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
   >Created with TopBraid Composer</owl:versionInfo>
 </owl:Ontology>
 <owl:ObjectProperty rdf:ID="op"/>
 <owl:DatatypeProperty rdf:ID="dp"/>
 <owl:Thing rdf:ID="y">
   <rdfs:label>foo</rdfs:label>
 </owl:Thing>
 <owl:Thing rdf:ID="x">
   <dp rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
   >data</dp>
   <op rdf:resource="#y"/>
 </owl:Thing>
</rdf:RDF>

<!-- Created with TopBraid Composer -->

-- 
Michael Schneider <m_schnei@gmx.de>


-- 
Michael Schneider <m_schnei@gmx.de>

Received on Tuesday, 5 June 2007 12:05:31 UTC