[Pellet-users] EQUIVALENT CLASS UNION ONTOLOGY

Alessandro Bruno alexbruno.lecce at gmail.com
Wed Jul 9 18:40:51 UTC 2008


Hi,
I wold like to get the equivalent classes from different ontologies.
I have created an ontmodel with a submodel an then i search the equivalent
class of the union model, but it doesn't work  :


OntModel model = ModelFactory.createOntologyModel
(PelletReasonerFactory.THE_SPEC );
    String path1="C:\\Dipartimento.owl";
    String ns1 = "http://www.owl-ontologies.com/Ontology1215619702.owl#";
    FileInputStream fin1 = new FileInputStream(path1);
    model.read(fin1, path1);

    //model.read(ontology1);

    OntModel model2 = ModelFactory.createOntologyModel
(PelletReasonerFactory.THE_SPEC );
    String path2="C:\\Universita.owl";
    String ns2 = "http://www.owl-ontologies.com/Ontology1215621323.owl#";
    FileInputStream fin2 = new FileInputStream(path2);
    model2.read(fin2, path2);

    //model2.read(ontology2);

    model.addSubModel(model2, true);

    System.out.print( "Classifying..." );
        //((PelletInfGraph) model.getGraph()).getKB().classify();
        System.out.println( "done" );



    for (Iterator ic = model.listClasses(); ic.hasNext(); ) {
        OntClass cl = (OntClass) ic.next();
        if (cl.getLocalName() != null) {
            System.out.print("La Classe " + cl.getLocalName() + " ha classi
equivalenti : ");
            for (Iterator is = cl.listEquivalentClasses(); is.hasNext(); ) {
            OntClass cs = (OntClass) is.next();
            if (cs.getLocalName() != null)
            System.out.print(cs.getLocalName() + " ");
            }
            System.out.println();
            }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.owldl.com/pipermail/pellet-users/attachments/20080709/4e708f17/attachment.htm 


More information about the Pellet-users mailing list