本文整理汇总了Java中org.semanticweb.owlapi.reasoner.SimpleConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java SimpleConfiguration类的具体用法?Java SimpleConfiguration怎么用?Java SimpleConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleConfiguration类属于org.semanticweb.owlapi.reasoner包,在下文中一共展示了SimpleConfiguration类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.semanticweb.owlapi.reasoner.SimpleConfiguration; //导入依赖的package包/类
public static void main(String[] args) throws OWLOntologyCreationException {
//register my built-in implementation
BuiltInRegistry.instance.registerBuiltIn("urn:makub:builtIn#IRIparts", new CustomSWRLBuiltin(new IRIparts()));
//initialize ontology and reasoner
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(IRI.create(DOC_URL));
OWLReasonerFactory reasonerFactory = PelletReasonerFactory.getInstance();
OWLReasoner reasoner = reasonerFactory.createReasoner(ontology, new SimpleConfiguration());
OWLDataFactory factory = manager.getOWLDataFactory();
PrefixDocumentFormat pm = manager.getOntologyFormat(ontology).asPrefixOWLOntologyFormat();
//print the SWRL rule
listSWRLRules(ontology);
//use the rule with the built-in to infer property values
OWLNamedIndividual martin = factory.getOWLNamedIndividual(":Martin", pm);
listAllDataPropertyValues(martin, ontology, reasoner);
}
开发者ID:martin-kuba,项目名称:owl2-swrl-tutorial,代码行数:17,代码来源:IndividualSWRLBuiltinTutorial.java
示例2: main
import org.semanticweb.owlapi.reasoner.SimpleConfiguration; //导入依赖的package包/类
public static void main(String[] args) throws OWLOntologyCreationException {
//register my built-in
BuiltInRegistry.instance.registerBuiltIn("urn:makub:builtIn#thisYear", new GeneralFunctionBuiltIn(new ThisYear()));
//initialize ontology and reasoner
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(IRI.create(DOC_URL));
OWLReasonerFactory reasonerFactory = PelletReasonerFactory.getInstance();
OWLReasoner reasoner = reasonerFactory.createReasoner(ontology, new SimpleConfiguration());
OWLDataFactory factory = manager.getOWLDataFactory();
PrefixDocumentFormat pm = manager.getOntologyFormat(ontology).asPrefixOWLOntologyFormat();
//use the rule with the built-in to infer data property values
OWLNamedIndividual martin = factory.getOWLNamedIndividual(":Martin", pm);
listAllDataPropertyValues(martin, ontology, reasoner);
OWLNamedIndividual ivan = factory.getOWLNamedIndividual(":Ivan", pm);
listAllDataPropertyValues(ivan, ontology, reasoner);
}
开发者ID:martin-kuba,项目名称:owl2-swrl-tutorial,代码行数:18,代码来源:SWRLBuiltInsTutorial.java
示例3: main
import org.semanticweb.owlapi.reasoner.SimpleConfiguration; //导入依赖的package包/类
public static void main(String[] args) throws OWLOntologyCreationException {
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(IRI.create(BASE_URL));
OWLReasonerFactory reasonerFactory = PelletReasonerFactory.getInstance();
OWLReasoner reasoner = reasonerFactory.createReasoner(ontology, new SimpleConfiguration());
Version v = reasoner.getReasonerVersion();
System.out.println("reasoner "+reasoner.getReasonerName()+ " " + v.getMajor()+"."+v.getMinor()+"."+v.getPatch()+" build "+v.getBuild());
OWLDataFactory factory = manager.getOWLDataFactory();
OWLClass aClass = factory.getOWLClass(IRI.create(BASE_URL+"#A"));
System.out.println("it will hang on the next line for Pellet 2.3 ...");
NodeSet<OWLNamedIndividual> nodeSet = reasoner.getInstances(aClass, false);
System.out.println("this is never printed");
}
开发者ID:martin-kuba,项目名称:owl2-swrl-tutorial,代码行数:16,代码来源:Pellet230Error.java
示例4: loadOntology
import org.semanticweb.owlapi.reasoner.SimpleConfiguration; //导入依赖的package包/类
private static void loadOntology(String Path) throws OWLOntologyCreationException {
//System.load("/Users/danielfuterman/dll/libFaCTPlusPlusJNI.jnilib");
//Load the Ontology and declare all ontology variables
manager = OWLManager.createOWLOntologyManager();
BeeOntologyfile = new File(Path);
//Xylocopa_v4
//BeeKeyOntology_V05
//BeeKeyOntology_v07
// AuronaMac:Applications/BeeKeyOntology_v07.owl
//C:/Windows/System32/BeeKeyOntology_v07.owl
if (BeeOntologyfile.exists())
{
BeeCharacteristics = manager.loadOntologyFromOntologyDocument(BeeOntologyfile);
factory1 = manager.getOWLDataFactory();
//Print what and where from out
System.out.println("Loaded ontology: " + BeeCharacteristics);
IRI documentIRI = manager.getOntologyDocumentIRI(BeeCharacteristics);
System.out.println(" from: " + documentIRI);
//Renderer to get the string text
renderer = new ManchesterOWLSyntaxOWLObjectRendererImpl();
fppRF = new FaCTPlusPlusReasonerFactory();
progressMonitor = new TimedConsoleProgressMonitor();
config = new SimpleConfiguration(progressMonitor);
config.getProgressMonitor();
// Create a reasoner that will reason over our ontology and its imports
// closure. Pass in the configuration.
//OWLReasoner reasoner = Rf.createReasoner(BeeCharacteristics, config);
// System.out.println("before reasoner create");
reasoner = fppRF.createReasoner(BeeCharacteristics, config);
}
}
开发者ID:jembi,项目名称:woc,代码行数:38,代码来源:Application.java
示例5: isEntailed
import org.semanticweb.owlapi.reasoner.SimpleConfiguration; //导入依赖的package包/类
public boolean isEntailed(final Set<OWLAxiom> axiom) {
TelemetryTimer timer = new TelemetryTimer();
TelemetryTimer loadTimer = new TelemetryTimer();
TelemetryTimer checkTimer = new TelemetryTimer();
TelemetryInfo info = new DefaultTelemetryInfo("entailmentcheck", timer, loadTimer, checkTimer);
TelemetryTransmitter transmitter = TelemetryTransmitter.getTransmitter();
transmitter.beginTransmission(info);
try {
// System.out.print("Checking entailment....");
transmitter.recordMeasurement(info, "input size", axiom.size());
counter++;
timer.start();
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
OWLOntology ont = man.createOntology(axiom);
SimpleConfiguration config = new SimpleConfiguration(timeout);
timer.start();
loadTimer.start();
OWLReasoner r = reasonerFactory.createReasoner(ont, config);
loadTimer.stop();
transmitter.recordTiming(info, "load time", timer);
checkTimer.start();
consistent = r.isConsistent();
checkTimer.stop();
timer.stop();
transmitter.recordTiming(info, "check time", checkTimer);
transmitter.recordTiming(info, "time", timer);
r.dispose();
// System.out.println(" done!");
return !consistent;
}
catch (OWLOntologyCreationException e) {
throw new OWLRuntimeException(e);
}
finally {
transmitter.endTransmission(info);
}
}
开发者ID:matthewhorridge,项目名称:owlexplanation,代码行数:40,代码来源:ConsistencyEntailmentChecker.java
示例6: getDefaultOwlReasonerConfiguration
import org.semanticweb.owlapi.reasoner.SimpleConfiguration; //导入依赖的package包/类
public static OWLReasonerConfiguration getDefaultOwlReasonerConfiguration(
ReasonerProgressMonitor monitor) {
return new SimpleConfiguration(monitor, FreshEntityPolicy.ALLOW, 0,
IndividualNodeSetPolicy.BY_NAME);
}
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:6,代码来源:ElkReasonerConfiguration.java
示例7: LazyExpressionMaterializingReasoner
import org.semanticweb.owlapi.reasoner.SimpleConfiguration; //导入依赖的package包/类
public LazyExpressionMaterializingReasoner(OWLOntology ont) {
this(ont, new SimpleConfiguration(), BufferingMode.BUFFERING);
}
开发者ID:owlcollab,项目名称:owltools,代码行数:4,代码来源:LazyExpressionMaterializingReasoner.java
示例8: createNonBufferingReasoner
import org.semanticweb.owlapi.reasoner.SimpleConfiguration; //导入依赖的package包/类
public OWLReasoner createNonBufferingReasoner(OWLOntology ontology) {
return createNonBufferingReasoner(ontology, new SimpleConfiguration());
}
开发者ID:owlcollab,项目名称:owltools,代码行数:4,代码来源:LazyExpressionMaterializingReasonerFactory.java
示例9: createReasoner
import org.semanticweb.owlapi.reasoner.SimpleConfiguration; //导入依赖的package包/类
public OWLReasoner createReasoner(OWLOntology ontology) {
return createReasoner(ontology, new SimpleConfiguration());
}
开发者ID:owlcollab,项目名称:owltools,代码行数:4,代码来源:LazyExpressionMaterializingReasonerFactory.java
示例10: main
import org.semanticweb.owlapi.reasoner.SimpleConfiguration; //导入依赖的package包/类
public static void main(String[] args) throws OWLOntologyCreationException, OWLOntologyStorageException {
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLDataFactory factory = manager.getOWLDataFactory();
// create new empty ontology
OWLOntology ontology = manager.createOntology(IRI.create(DOCUMENT_IRI));
//set up prefixes
DefaultPrefixManager pm = new DefaultPrefixManager();
pm.setDefaultPrefix(DOCUMENT_IRI + "#");
pm.setPrefix("var:", "urn:swrl#");
//class declarations
OWLClass personClass = factory.getOWLClass(":Person", pm);
manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(personClass));
OWLClass manClass = factory.getOWLClass(":Man", pm);
manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(manClass));
OWLClass englishProgrammerClass = factory.getOWLClass(":EnglishProgrammer", pm);
manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(englishProgrammerClass));
//named individuals declarations
OWLNamedIndividual english = createIndividual(ontology, pm, manager, ":English");
OWLNamedIndividual comp = createIndividual(ontology, pm, manager, ":Computer-Programming");
OWLNamedIndividual john = createIndividual(ontology, pm, manager, ":John");
//annotated subclass axiom
OWLAnnotationProperty annotationProperty = factory.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_COMMENT.getIRI());
OWLAnnotationValue value = factory.getOWLLiteral("States that every man is a person.");
OWLAnnotation annotation = factory.getOWLAnnotation(annotationProperty, value);
OWLSubClassOfAxiom subClassOfAxiom = factory.getOWLSubClassOfAxiom(manClass, personClass, Collections.singleton(annotation));
manager.addAxiom(ontology, subClassOfAxiom);
//object property declaration
OWLObjectProperty speaksLanguageProperty = createObjectProperty(ontology, pm, manager, ":speaksLanguage");
OWLObjectProperty hasKnowledgeOfProperty = createObjectProperty(ontology, pm, manager, ":hasKnowledgeOf");
//axiom - John is a Person
manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(personClass, john));
//axiom - John speaksLanguage English
manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(speaksLanguageProperty, john, english));
//axiom - John hasKnowledgeOf Computer-Programming
manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(hasKnowledgeOfProperty, john, comp));
//axiom - EnglishProgrammers is equivalent to intersection of classes
OWLObjectHasValue c1 = factory.getOWLObjectHasValue(speaksLanguageProperty, english);
OWLObjectHasValue c2 = factory.getOWLObjectHasValue(hasKnowledgeOfProperty, comp);
OWLObjectIntersectionOf andExpr = factory.getOWLObjectIntersectionOf(personClass, c1, c2);
manager.addAxiom(ontology, factory.getOWLEquivalentClassesAxiom(englishProgrammerClass, andExpr));
//SWRL rule - Person(?x),speaksLanguage(?x,English),hasKnowledgeOf(?x,Computer-Programming)->englishProgrammer(?x)
SWRLVariable varX = factory.getSWRLVariable(pm.getIRI("var:x"));
Set<SWRLAtom> body = new LinkedHashSet<>();
body.add(factory.getSWRLClassAtom(personClass, varX));
body.add(factory.getSWRLObjectPropertyAtom(speaksLanguageProperty, varX, factory.getSWRLIndividualArgument(english)));
body.add(factory.getSWRLObjectPropertyAtom(hasKnowledgeOfProperty, varX, factory.getSWRLIndividualArgument(comp)));
Set<? extends SWRLAtom> head = Collections.singleton(factory.getSWRLClassAtom(englishProgrammerClass, varX));
SWRLRule swrlRule = factory.getSWRLRule(body, head);
manager.addAxiom(ontology, swrlRule);
//save to a file
FunctionalSyntaxDocumentFormat ontologyFormat = new FunctionalSyntaxDocumentFormat();
ontologyFormat.copyPrefixesFrom(pm);
manager.saveOntology(ontology, ontologyFormat, IRI.create(new File("example.owl").toURI()));
//reason
OWLReasonerFactory reasonerFactory = PelletReasonerFactory.getInstance();
OWLReasoner reasoner = reasonerFactory.createReasoner(ontology, new SimpleConfiguration());
for (OWLNamedIndividual person : reasoner.getInstances(personClass, false).getFlattened()) {
System.out.println("person : " + renderer.render(person));
}
for (OWLNamedIndividual englishProgrammer : reasoner.getInstances(englishProgrammerClass, false).getFlattened()) {
System.out.println("englishProgrammer : " + renderer.render(englishProgrammer));
}
}
开发者ID:martin-kuba,项目名称:owl2-swrl-tutorial,代码行数:78,代码来源:CreateOntologyInCodeExample.java
注:本文中的org.semanticweb.owlapi.reasoner.SimpleConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论