[Pellet-users] Remote inference

João Paulo Sousa jpaulo at ipb.pt
Fri Jan 18 01:18:05 UTC 2008


Hi,

I need to call the above method through a webpage. I'm thinking to  
transform this method to a web service.

This is possible? Or there exist a better solution to solve this  
problem?

Cheers,

João

            public  void  getRelactiveLoccation() throws  
OWLOntologyCreationException {

		String ns1 = "http://icas.ipb.pt/myontologies/spatial.owl#";

		OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
		OWLDataFactory factory = manager.getOWLDataFactory();

		// read the ontology
		System.out.print( "Reading file " + spatialdata + "..." );
		OWLOntology ontology =  
manager.loadOntology( URI.create( spatialdata ) );
		System.out.println( "done." );
		
		// IMPORTANT: The option to enable tracing should be turned on before
		// the ontology is loaded to the reasoner!
		PelletOptions.USE_TRACING = true;

		// create the reasoner and load the ontology
		Reasoner pellet = new Reasoner( manager ) {};
		pellet.loadOntology( ontology );

                // create some concepts
		OWLClass room = factory.getOWLClass( URI.create( ns1 +  
"SpatialThing" ) );
		OWLClass country = factory.getOWLClass( URI.create( ns1 +  
"Country" ) );
		OWLClass city = factory.getOWLClass( URI.create( ns1 + "City" ) );

                OWLObjectProperty isPartOf =  
factory.getOWLObjectProperty(URI.create(ns1+"isPartOf"));
                OWLIndividual indBar =  
factory.getOWLIndividual(URI.create(ns1+"Bar"));
                OWLIndividual indPortugal =  
factory.getOWLIndividual(URI.create(ns1+"Portugal"));

        	pellet.getKB().setDoExplanation( true );

		// check for concept satisfiability
		pellet.isSatisfiable( room );
                OWLObjectPropertyAssertionAxiom relation =  
factory.getOWLObjectPropertyAssertionAxiom(indPortugal,  
isPartOf,indBar );

                System.out.println("Is bar part of Portugal: "  +  
pellet.hasObjectPropertyRelationship(indBar,  
isPartOf ,indPortugal ));                                       		
	
	}



More information about the Pellet-users mailing list