From: Hart, Lewis ([email protected])
Date: 06/28/01
-----Original Message----- From: Marin Dimitrov [mailto:[email protected]] Sent: Thursday, June 28, 2001 8:22 AM To: [email protected]; [email protected] Subject: DAML API usage > >Hi, > >What is the correct sequence of API calls for creating an ontology from >scratch and exporting it in RDFS? > >The following fragment is not working: > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > > DAMLOntology coreOntology = new DAML(new >DAMLOntologyImp(DAML.DAML_URI)); > DAMLOntology ewnOntology = new DAMLOntologyImp(); > ewnOntology.addImport(coreOntology); > > DAMLClass classTop = ewnOntology.createClass("Top"); > classTop.addSubClassOf(DAML.Class); > > DAMLClass class1 = ewnOntology.createClass("FirstOrderEntity"); > class1.addSubClassOf(classTop); > > DAMLClass class2 = ewnOntology.createClass("SecondOrderEntity"); > class2.addSubClassOf(classTop); > > .......... > > Model m = ewnOntology.toRDFModel(); > RDFUtil.dumpModel(m, > System.out, > >(RDFSerializer)Class.forName("org.w3c.rdf.implementation.syntax.sirpac.SiRS " >).newInstance()); > > .......... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > The above code is correct. You have found a (rather obvious) bug in the toRDFModel code, a fix will be posted later today. > > >The output looks like: > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > ><?xml version='1.0' encoding='ISO-8859-1'?> ><!DOCTYPE rdf:RDF [ > <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> > <!ENTITY a 'http://www.daml.org/2001/03/daml+oil#'> > <!ENTITY b ''> >]> ><rdf:RDF xmlns:rdf="&rdf;" > xmlns:a="&a;" > xmlns:b="&b;"> ><a:Class rdf:about="FirstOrderEntity"/> ><a:Class rdf:about="SecondOrderEntity"/> ><a:Class rdf:about="Top"/> ></rdf:RDF> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > > >i.e. the subClassOf relations are missing - in fact the RDFS namespace in >not referenced at all, and additionally there exists a namespace "b" which >is never used. The RDFS namespace is not used, because the DAML+OIL resouces are used where applicable. That is, daml:Class rather than rdfs:class. After all, this is a DAML ontology. I don't know where the extra null namespace, in this case "b", is comming from. It does no harm so it is a low priority. > >The API docs and samples are not that helpful so I'll appreciate any hints Sorry about that. I know one thing that is missing is that there is no example of building an ontology programmatically. That is coming shortly. Do you have any specific comments? > >thanx, > > Marin > >---- >"When someone is seeking, it happens quite easily that he only sees >the thing that he is seeking; that he is unable to find anything, unable to >absorb anything, because he is only thinking of the thing he is seeking, >because he is obsessed with his goal. Seeking means: to have a goal; >but finding means: to be free, to be receptive, to have no goal. ..." > > > Herman Hesse, "Siddhartha" > > > >
This archive was generated by hypermail 2.1.4 : 04/03/02 EST