On 14/01/13 14:31, hlel emna wrote:
hi,
I search method that adds value to OBJECTPROPERTY and adds value
to DataProperty.
OntModel m=
ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF);
String ns =new String("http://www.example.com/onto1#");
String base=new String("http://www.example.com/onto1");
You don't need to new String(), just
String ns = ".... ";
is fine.
//create class
OntClass f = m.createClass(ns+ "femme" );
OntClass h = m.createClass(ns+ "homme" );
// create individual
Individual h1 = m.createIndividual( ns + "john", h );
Individual f1 = m.createIndividual( ns + "pretty", f );
//create ObjectProperty
ObjectProperty ma = m.createObjectProperty(ns + "marier" );
ma.addDomain(h);ma.addRange(f);
//create DataProperty
DatatypeProperty nom = m.createDatatypeProperty(ns+"nom");
nom.addDomain(h);
//add values to objectproperty and Dataproperty
h1.addProperty(ma,f1);
h1.addProperty(nom,"john");
I write this code but the problem is adding
value in ObjectProperty and in Dataproperty
You say that you have a problem with object and data properties, but you
don't say what the problem *is*. Are you getting a result you don't
expect - if so, what? Are you getting an exception - if so, what is it?
Unless you give us enough information, we can't answer your question.
Ian
--
____________________________________________________________
Ian Dickinson Epimorphics Ltd, Bristol, UK
mailto:[email protected] http://www.epimorphics.com
cell: +44-7786-850536 landline: +44-1275-399069
------------------------------------------------------------
Epimorphics Ltd. is a limited company registered in England
(no. 7016688). Registered address: Court Lodge, 105 High St,
Portishead, Bristol BS20 6PT, UK