DAML API usage

From: Marin Dimitrov ([email protected])
Date: 06/28/01


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 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 API docs and samples are not that helpful so I'll appreciate any hints

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