On 04/09/13 14:00, Luis Eufrasio Teixeira Neto wrote:
Dear All,
I am trying to load an Ontology (attached)
This list doesn't support attachments but see below ...
where there are classes with
the same datatype property. For example:
foaf:Document a owl:Class , rdfs:Class ;
rdfs:label "foaf:Document" ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onProperty dc:creator ;
owl:maxCardinality "2"^^<http://www.w3.org/2001/XMLSchema#int>
] .
dc:title
a rdf:Property , owl:DatatypeProperty ;
rdfs:domain foaf:Document;
rdfs:label "dc:title" ;
rdfs:range xsd:string .
*dc:date*
* a rdf:Property , owl:DatatypeProperty ;*
* rdfs:domain foaf:Document;*
* rdfs:label "dc:date" ;*
* rdfs:range xsd:string .*
and
conf:Conference a owl:Class , rdfs:Class ;
rdfs:label "conf:Conference" .
rdfs:label
a rdf:Property , owl:DatatypeProperty ;
rdfs:domain conf:Conference;
rdfs:label "rdfs:label" ;
rdfs:range xsd:string .
*dc:date*
* a rdf:Property , owl:DatatypeProperty ;*
* rdfs:domain conf:Conference;*
* rdfs:label "dc:date" ;*
* rdfs:range xsd:string .*
*
*
So datatype property dc:date is reused into classes foaf:Document and
conf:Conference.
Ugh. That's not a good idea and doesn't mean what you think it means.
The net effect is that semantically you are saying that anything with a
dc:date is both a conf:Conference and a foaf:Document. Whereas probably
there is nothing in the intersection of those two.
Ideally don't redeclare dc:date at all. If you do want to express that
e.g. a conf:Conference can have a dc:date then use an OWL restriction.
The problem is: when I load the ontology the datatype porperty dc:date
only appears one time with conf:Conference as domain class.
No, both declarations will be in the model, you can check this by
listing all the properties of dc:date in your model.
You are only seeing one in your code because ...
if (datatypeProperty.getDomain() != null &&
datatypeProperty.getRange() != null) {
String dClassPrefix =
ontModel.getNsURIPrefix(datatypeProperty.getDomain().getNameSpace());
... here you are calling getDomain which can only return a single
domain, if there are multiple ones then it will just pick one.
Use OntClass.listDomain instead.
Dave