We can't see your ontology and you don't list the results of your test case.

However, the Jena rule reasoners are (fragments of) OWL full, not OWL DL. In OWL full then semantically you can state that two literals are sameas, you just can't directly express it syntactically in RDF. The reasoners work internally using graphs which remove that syntactic constraint.

There is no DL reasoner for Jena supplied out of the box. You may wish to look at commercial offerings such as Pellet.

Dave

On 14/05/13 15:20, Ed Swing wrote:
I discovered a significant bug when dealing with SameAs and functional
properties. Here’s the Java code:

*import*java.io.FileInputStream;

*import*java.io.IOException;

*import*java.util.Iterator;

*import*com.hp.hpl.jena.ontology.*;

*import*com.hp.hpl.jena.rdf.model.ModelFactory;

*import*com.hp.hpl.jena.reasoner.ValidityReport;

*public**class*SameAsTest {

*public**static**void*main(String[] args) *throws*IOException {

         OntModel m =


ModelFactory./createOntologyModel/(OntModelSpec./OWL_DL_MEM_RULE_INF/);

         FileInputStream inStream =
*new*FileInputStream("ontology/vehicle.owl");

         m.read(inStream, *null*);

         inStream.close();

         String uriBase = m.getNsPrefixURI("");

         OntClass vehCls = m.getOntClass(uriBase + "Vehicle");

         Individual myCar = vehCls.createIndividual(uriBase +
"/data/myCar");

         DatatypeProperty wheels = m.getDatatypeProperty(uriBase +
"numWheels");

// state that myCar has 4 wheels

         myCar.addProperty(wheels, "4");

// do the same for another vehicle

         Individual redCrv = vehCls.createIndividual(uriBase +
"/data/redCrv");

         redCrv.addProperty(wheels, "4");

// now add the fact that the redCrv and myCar are the same object

         myCar.addSameAs(redCrv);

         ValidityReport rept = m.validate();

*for*(Iterator<ValidityReport.Report> riter = rept.getReports(); riter

             .hasNext();) {

             ValidityReport.Report rep = riter.next();

             System./out/.println("ValRep: "+ rep.getDescription());

         }

     }

}

The relevant ontology is attached to this message. The crucial thing is
that numWheels is a datatype property, with a max cardinality of 1 for
the Vehicle class.

When the two vehicles are linked via the SameAs property, the number of
wheels are also linked because of cardinality. However, sameAs doesn’t
allow datatype values (literals) to be linked. It’s even more annoying
in this case since the two values are in fact the same.

This also occurs if I declare the numWheels property as a functional
property, so that’s no help.

*Edward Swing*

*Applied Research Technologist*

*Vision Systems + Technology, Inc., a SAS Company*

6021 University Boulevard • Suite 360 • Ellicott City • Maryland • 21043

*Tel:*410.418.5555 *Ext:*919 • *Fax:*410.418.8580

*Email*:[email protected] <mailto:[email protected]>

*Web:*http://www.vsticorp.com <http://www.vsticorp.com/>


Reply via email to