Hi Olivier,

On 24/06/12 19:12, Olivier Rossel wrote:
Hello all.

I wish I could create a RDFS schema and declare a property's domain to
be either class A or class B.
I wrote such a sample:
<owl:DatatypeProperty rdf:about="http://xmlns.com/foaf/0.1/name";>
               <rdfs:domain rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
               <rdfs:range
rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
       </owl:DatatypeProperty>

<owl:DatatypeProperty rdf:about="http://xmlns.com/foaf/0.1/name";>
               <rdfs:domain
rdf:resource="http://purl.org/net/schemas/space/Spacecraft"/>
               <rdfs:range
rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
       </owl:DatatypeProperty>


This RDFS snippet, once loaded in Jena, leads to the "name" not to be
listed for neither
class Person nor Spacecraft.
FYI, I use the OntClass.listDeclaredProperties(false) method on a model
with OntModelSpec.RDFS_MEM_RDFS_INF profile.

If I remove the second statement (the one where domain is Spacecraft),
then Person retrieves "name"
as one of its properties.

Correct. You have declared the domain to be *both* a Person and a Spacecraft rather than Person or Spacecraft.

Here are my questions:
Is it possible to declare in RDFS a property's domain to be either
class A or B?

Yes using unionOf.

Or must I really switch to OWL and say that owl:unionOf (A, B) is the
domain of my property?

You are already using OWL so not sure what you mean by "switch", but yes that's what you need.

If I must use owl:unionOf, which minimum Jena profile will process
that unionOf? OWL_LITE_MEM?

OWL_MEM_MICRO_RULE_INF should do it.

Dave

Reply via email to