- From: Robert Langner <robert.langner@freenet.de>
- Date: Wed, 14 May 2008 21:40:44 +0200
- To: <semantic-web@w3.org>
- Message-ID: <000001c8b5fa$673d6f30$35b84d90$@langner@freenet.de>
Hello,
i`m trying to read a class,individual, objectproperty from an Ontology.
But every time I run my program it cannot load the class,individual,etc.
from the ontology and I get NULL for every Object.
import java.net.URI;
import org.mindswap.exceptions.ExecutionException;
import org.mindswap.exceptions.PreconditionException;
import org.mindswap.owl.OWLClass;
import org.mindswap.owl.OWLFactory;
import org.mindswap.owl.OWLIndividual;
import org.mindswap.owl.OWLKnowledgeBase;
import org.mindswap.owl.OWLObjectProperty;
import org.mindswap.owl.OWLProperty;
import org.mindswap.owls.OWLSFactory;
import org.mindswap.owls.process.Process;
import org.mindswap.owls.process.execution.ProcessExecutionEngine;
import org.mindswap.owls.service.Service;
import org.mindswap.query.ValueMap;
import org.semanticweb.owl.apibinding.OWLManager;
import org.semanticweb.owl.model.OWLOntologyManager;
import org.mindswap.owl.OWLDataProperty;
import org.mindswap.owl.OWLDataValue;
import org.mindswap.owls.profile.Profile;
import org.mindswap.wsdl.WSDLOperation;
import org.mindswap.wsdl.WSDLService;
public class precCheck {
OWLOntologyManager manager ;
String ontUri ;
public void run() throws Exception {
ontUri = "http://www.haunstetten-handball.de/OrderOntologie#";
manager = OWLManager.createOWLOntologyManager();
OWLKnowledgeBase kb = OWLFactory.createKB();
ProcessExecutionEngine pe = OWLSFactory.createExecutionEngine();
kb.setReasoner("Pellet");
kb.read(
"http://www.haunstetten-handball.de/OrderOntologie.owl#" );
System.out.println(kb.getOntologies());
//kb.createOntology(URI.create(ontUri));
String physUri = "f://owls//simpleCC.owl";
//URI uri = URI.create("file:/" + physUri);
Service service = kb.readService("file:/" + physUri);
Process process = service.getProcess();
OWLClass orderState = kb.getClass(URI.create(ontUri +
"OrderState"));
System.out.println(orderState);
//org.semanticweb.owl.model.OWLClass orderState =
manager.getOWLDataFactory().getOWLClass(URI.create(ontUri + "OrderState"));
//System.out.println(orderState);
OWLIndividual valid = kb.getIndividual(URI.create(ontUri +
"OrderState"));
//org.semanticweb.owl.model.OWLObjectProperty stateEnum =
manager.getOWLDataFactory().getOWLObjectProperty(URI.create(ontUri +
"OrderState_hasStateEnum"));
System.out.println(valid);}
//org.semanticweb.owl.model.OWLIndividual valid =
manager.getOWLDataFactory().getOWLIndividual(URI.create(ontUri + "valid"));
//System.out.println(valid);}
/*valid.addType(orderState);
valid.addProperty(stateEnum, valid);
ValueMap values = new ValueMap();
pe.setPreconditionCheck(true);
System.out.println( "Precondition check enabled" );
System.out.println( "---------------------------" );
}
try{
values.setValue(process.getInput("CC_OrderState"),
orderState);
System.out.println( "Trying supported Input..." );
System.out.println( "Precondition satisfied: " +
process.getCondition().isTrue(values) );
pe.execute(process, values);
System.out.println("Execution successecful!");
}catch(PreconditionException e){
System.out.println("Precondition evaluation failed!");
System.out.println(e);
}catch(ExecutionException e){
System.out.println("Execution failed!");
System.out.println(e);
}
}*/
public static void main(String[] args) throws Exception {
precCheck test = new precCheck();
test.run();
}
}
Received on Wednesday, 14 May 2008 19:41:03 UTC