本文整理汇总了Java中org.semanticweb.owlapi.reasoner.OWLReasonerFactory类的典型用法代码示例。如果您正苦于以下问题:Java OWLReasonerFactory类的具体用法?Java OWLReasonerFactory怎么用?Java OWLReasonerFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OWLReasonerFactory类属于org.semanticweb.owlapi.reasoner包,在下文中一共展示了OWLReasonerFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: beforeClass
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
// Setup environment.
ParserWrapper pw = new ParserWrapper();
//NOTE: Yes, the GO here is unnecessary, but we're trying to also catch a certain behavior
// where auxilery ontologies are not caught. The best wat to do that here is to load ECO
// second and then do the merge.
OWLOntology ont_main = pw.parse(getResourceIRIString("go_xp_predictor_test_subset.obo"));
OWLOntology ont_scnd = pw.parse(getResourceIRIString("eco.obo"));
g = new OWLGraphWrapper(ont_main);
g.addSupportOntology(ont_scnd);
// NOTE: This step is necessary or things will get ignored!
// (This cropped-up in the loader at one point.)
for (OWLOntology ont : g.getSupportOntologySet())
g.mergeOntology(ont);
OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
r = reasonerFactory.createReasoner(g.getSourceOntology());
g.setReasoner(r);
}
开发者ID:owlcollab,项目名称:owltools,代码行数:24,代码来源:EcoToolsTest.java
示例2: beforeClass
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
// Setup environment.
ParserWrapper pw = new ParserWrapper();
//NOTE: Yes, the GO here is unnecessary, but we're trying to also catch a certain behavior
// where auxiliary ontologies are not caught. The best way to do that here is to load taxslim
// second and then do the merge.
OWLOntology ont_main = pw.parse(getResourceIRIString("go_xp_predictor_test_subset.obo"));
OWLOntology ont_scnd = pw.parse(getResourceIRIString("taxslim.obo"));
g = new OWLGraphWrapper(ont_main);
g.addSupportOntology(ont_scnd);
// NOTE: This step is necessary or things will get ignored!
// (This cropped-up in the loader at one point.)
for (OWLOntology ont : g.getSupportOntologySet())
g.mergeOntology(ont);
OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
r = reasonerFactory.createReasoner(g.getSourceOntology());
g.setReasoner(r);
}
开发者ID:owlcollab,项目名称:owltools,代码行数:24,代码来源:TaxonToolsTest.java
示例3: createSubOntologyFromDLQuery
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
/**
* Create a new sub ontology from a given DL query and source ontology. The
* subset will be created in the target ontology.
*
* @param namedQuery
* @param sourceGraph
* @param targetGraph
* @param reasonerFactory
* @param toMerge
*/
public void createSubOntologyFromDLQuery(OWLClass namedQuery,
OWLGraphWrapper sourceGraph, OWLGraphWrapper targetGraph,
OWLReasonerFactory reasonerFactory, Set<OWLOntology> toMerge)
{
try {
Set<OWLClass> subset = DLQueryTool.executeQuery(namedQuery, sourceGraph.getSourceOntology(), reasonerFactory);
if (subset.isEmpty()) {
return;
}
createSubSet(targetGraph, subset, toMerge);
} catch (OWLOntologyCreationException e) {
LOG.error("Could not create ontology.", e);
// TODO throw Exception?
return;
}
}
开发者ID:owlcollab,项目名称:owltools,代码行数:27,代码来源:QuerySubsetGenerator.java
示例4: testSubsetterSpecies
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
@Test
public void testSubsetterSpecies() throws Exception {
ParserWrapper p = new ParserWrapper();
p.setCheckOboDoc(false);
OWLOntology owlOntology = p.parse(getResourceIRIString("speciesMergeTest.obo"));
OWLGraphWrapper graph = new OWLGraphWrapper(owlOntology);
OWLReasonerFactory rf = new ElkReasonerFactory();
OWLReasoner reasoner = rf.createReasoner(graph.getSourceOntology());
SpeciesSubsetterUtil smu = new SpeciesSubsetterUtil(graph);
//smu.viewProperty = graph.getOWLObjectPropertyByIdentifier("BFO:0000050");
smu.taxClass = graph.getOWLClassByIdentifier("T:1");
smu.reasoner = reasoner;
smu.removeOtherSpecies();
p.saveOWL(smu.ont, new OBODocumentFormat(), "target/speciesSubset.obo");
//p.saveOWL(smu.ont, getResourceIRIString("target/speciesSubset.owl"));
assertNull(graph.getOWLClassByIdentifier("U:24"));
}
开发者ID:owlcollab,项目名称:owltools,代码行数:20,代码来源:SpeciesSubsetterUtilTest.java
示例5: testMergeSpecies
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
@Test
public void testMergeSpecies() throws Exception {
ParserWrapper p = new ParserWrapper();
OWLOntology owlOntology = p.parse(getResourceIRIString("speciesMergeTest.obo"));
OWLGraphWrapper graph = new OWLGraphWrapper(owlOntology);
OWLReasonerFactory rf = new ElkReasonerFactory();
OWLReasoner reasoner = rf.createReasoner(graph.getSourceOntology());
SpeciesMergeUtil smu = new SpeciesMergeUtil(graph);
smu.viewProperty = graph.getOWLObjectPropertyByIdentifier("BFO:0000050");
smu.taxClass = graph.getOWLClassByIdentifier("T:1");
smu.reasoner = reasoner;
smu.suffix = "coelocanth";
smu.merge();
p.saveOWL(smu.ont, new OBODocumentFormat(), "target/speciesMergeOut.obo");
}
开发者ID:owlcollab,项目名称:owltools,代码行数:18,代码来源:SpeciesMergeUtilTest.java
示例6: main
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的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
示例7: main
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的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
示例8: main
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
long start = System.currentTimeMillis();
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
// loading the root ontology
OWLOntology root = null;
try {
root = man.loadOntologyFromOntologyDocument(new File(
"C:\\dev\\ontologies\\owl\\snomed_20130131_stated.owl"));
} catch (OWLOntologyCreationException e) {
e.printStackTrace();
return;
}
System.out.println("owl-api loading: "+(System.currentTimeMillis()-start));
// Create a Snorocket reasoner and classify
OWLReasonerFactory reasonerFactory = new SnorocketReasonerFactory();
OWLReasoner reasoner = reasonerFactory.createNonBufferingReasoner(root);
reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
reasoner.dispose();
System.out.println(Statistics.INSTANCE.getStatistics());
System.out.println("Total time: "+Statistics.INSTANCE.getTotalTime());
}
开发者ID:aehrc,项目名称:snorocket,代码行数:28,代码来源:OWLBenchmark.java
示例9: DLPPINotAnalyser
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
public DLPPINotAnalyser(Bpmn20ModelHandlerInterface bpmnModelHandler, PpiNotModelHandlerInterface ppinotModelHandler, OWLReasonerFactory reasonerFactory) {
this.bpmnModelHandler = bpmnModelHandler;
this.ppinotModelHandler = ppinotModelHandler;
owlManager = OWLManager.createOWLOntologyManager();
conversor = new IdOwlConversor();
try {
BPMN2OWLConverterInterface bpmnConverter = new BPMN2OWLConverter(BPMN_BASE_IRI, owlManager);
bpmnOntology = bpmnConverter.convertToOwlOntology(bpmnModelHandler);
String bpmnOntologyURI = bpmnConverter.getOntologyURI();
PPINOT2OWLConverterInterface ppinotConverter = new PPINOT2OWLConverter(PPINOT_BASE_IRI, owlManager);
ppinotConverter.setBpmnData(bpmnOntologyURI, bpmnModelHandler);
ppinotOntology = ppinotConverter.convertToOwlOntology(ppinotModelHandler);
} catch (OWLOntologyCreationException e) {
throw new RuntimeException(e);
}
AnalysisOntologyBuilder builder = new AnalysisOntologyBuilder(owlManager);
String analysisURI = PPINOT_BASE_IRI + bpmnModelHandler.getProcId() + "-analysis.owl";
analysisOntology = builder.buildAnalysisOntology(analysisURI, ppinotOntology);
engine = new DLQueryEngine(reasonerFactory.createReasoner(analysisOntology));
}
开发者ID:isa-group,项目名称:ppinot,代码行数:26,代码来源:DLPPINotAnalyser.java
示例10: StructuralRootDerivedReasoner
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
public StructuralRootDerivedReasoner(OWLOntologyManager man, OWLReasoner reasoner, OWLReasonerFactory reasonerFactory) {
this.man = man;
this.reasonerFactory = reasonerFactory;
this.reasoner = reasoner;
this.child2Parent = new HashMap<OWLClass, Set<OWLClass>>();
this.parent2Child = new HashMap<OWLClass, Set<OWLClass>>();
roots = new HashSet<OWLClass>();
try {
getMergedOntology();
}
catch (ExplanationException e) {
e.printStackTrace();
}
dirty = true;
}
开发者ID:matthewhorridge,项目名称:owlexplanation,代码行数:17,代码来源:StructuralRootDerivedReasoner.java
示例11: InferenceProviderCreatorImpl
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
InferenceProviderCreatorImpl(OWLReasonerFactory rf, int maxConcurrent, boolean useSLME, String name) {
super();
this.rf = rf;
this.useSLME = useSLME;
this.name = name;
this.concurrentLock = new Semaphore(maxConcurrent);
}
开发者ID:geneontology,项目名称:minerva,代码行数:8,代码来源:InferenceProviderCreatorImpl.java
示例12: main
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
static public void main (String[] args) throws OWLException,
InstantiationException, IllegalAccessException,
ClassNotFoundException {
String reasonerFactoryClassName = null;
String pathToOwlOntology = "/Users/piek/Desktop/NWR/NWR-ontology/version-0.6/ESO_version_0.6.owl";
OWLOntologyManager m = (OWLOntologyManager) OWLManager.getOWLDataFactory();
@SuppressWarnings("null")
//@Nonnull
IRI documentIRI = IRI.create(pathToOwlOntology);
OWLOntology ontology = m
.loadOntologyFromOntologyDocument(documentIRI);
// Report information about the ontology
System.out.println("Ontology Loaded...");
System.out.println("Document IRI: " + documentIRI);
System.out.println("Ontology : " + ontology.getOntologyID());
System.out.println("Format : "
+ m.getOntologyFormat(ontology));
@SuppressWarnings("null")
OwlReader2 simpleHierarchy = new OwlReader2(
(OWLReasonerFactory) Class.forName(reasonerFactoryClassName)
.newInstance(), ontology);
// Get Thing
OWLClass clazz = m.getOWLDataFactory().getOWLThing();
System.out.println("Class : " + clazz);
// Print the hierarchy below thing
simpleHierarchy.printHierarchy(clazz);
}
开发者ID:newsreader,项目名称:StreamEventCoreference,代码行数:31,代码来源:OwlReader2.java
示例13: BlackBoxExplanationExtractor
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
public BlackBoxExplanationExtractor(
OWLOntology ontology,
OWLReasonerFactory reasonerFactory,
OWLReasoner reasoner,
int maxExplanations){
this(ontology, reasonerFactory, reasoner, Collections.EMPTY_SET, maxExplanations);
}
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:8,代码来源:BlackBoxExplanationExtractor.java
示例14: main
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
/**
* @param args
* @throws OWLOntologyCreationException
*/
public static void main(String[] args) throws OWLOntologyCreationException {
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
// Load your ontology.
OWLOntology ont = man
.loadOntologyFromOntologyDocument(new File(args[0]));
// Create an ELK reasoner.
OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
OWLReasoner reasoner = reasonerFactory.createReasoner(ont);
// Precompute instances for each named class in the ontology
reasoner.precomputeInferences(InferenceType.CLASS_ASSERTIONS);
// List representative instances for each class.
for (OWLClass clazz : ont.getClassesInSignature()) {
for (Node<OWLNamedIndividual> individual : reasoner.getInstances(
clazz, true)) {
System.out.println(clazz + "("
+ individual.getRepresentativeElement() + ")");
}
}
// Terminate the worker threads used by the reasoner.
reasoner.dispose();
}
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:31,代码来源:RetrievingInstances.java
示例15: main
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
public static void main(String[] args) throws OWLOntologyStorageException,
OWLOntologyCreationException {
OWLOntologyManager inputOntologyManager = OWLManager.createOWLOntologyManager();
OWLOntologyManager outputOntologyManager = OWLManager.createOWLOntologyManager();
// Load your ontology.
OWLOntology ont = inputOntologyManager.loadOntologyFromOntologyDocument(new File("path-to-ontology"));
// Create an ELK reasoner.
OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
OWLReasoner reasoner = reasonerFactory.createReasoner(ont);
// Classify the ontology.
reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
// To generate an inferred ontology we use implementations of
// inferred axiom generators
List<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<InferredAxiomGenerator<? extends OWLAxiom>>();
gens.add(new InferredSubClassAxiomGenerator());
gens.add(new InferredEquivalentClassAxiomGenerator());
// Put the inferred axioms into a fresh empty ontology.
OWLOntology infOnt = outputOntologyManager.createOntology();
InferredOntologyGenerator iog = new InferredOntologyGenerator(reasoner,
gens);
iog.fillOntology(outputOntologyManager.getOWLDataFactory(), infOnt);
// Save the inferred ontology.
outputOntologyManager.saveOntology(infOnt,
new FunctionalSyntaxDocumentFormat(),
IRI.create((new File("path-to-output").toURI())));
// Terminate the worker threads used by the reasoner.
reasoner.dispose();
}
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:36,代码来源:SavingInferredAxioms.java
示例16: main
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
public static void main(String[] args) throws OWLOntologyStorageException,
OWLOntologyCreationException {
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
// Load your ontology
OWLOntology ont = manager.loadOntologyFromOntologyDocument(new File("path-to-ontology"));
// Create an ELK reasoner.
OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
OWLReasoner reasoner = reasonerFactory.createReasoner(ont);
// Classify the ontology.
reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
OWLDataFactory factory = manager.getOWLDataFactory();
OWLClass subClass = factory.getOWLClass(IRI.create("http://www.co-ode.org/ontologies/galen#AbsoluteShapeState"));
OWLAxiom removed = factory.getOWLSubClassOfAxiom(subClass, factory.getOWLClass(IRI.create("http://www.co-ode.org/ontologies/galen#ShapeState")));
OWLAxiom added = factory.getOWLSubClassOfAxiom(subClass, factory.getOWLClass(IRI.create("http://www.co-ode.org/ontologies/galen#GeneralisedStructure")));
// Remove an existing axiom, add a new axiom
manager.addAxiom(ont, added);
manager.removeAxiom(ont, removed);
// This is a buffering reasoner, so you need to flush the changes
reasoner.flush();
// Re-classify the ontology, the changes should be accommodated
// incrementally (i.e. without re-inferring all subclass relationships)
// You should be able to see it from the log output
reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
// Terminate the worker threads used by the reasoner.
reasoner.dispose();
}
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:34,代码来源:IncrementalClassification.java
示例17: getOWLReasonerFactory
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
@Override
protected OWLReasonerFactory getOWLReasonerFactory() {
try {
Class<?> pelletFactoryClass = Class.forName("com.clarkparsia.modularity.PelletIncremantalReasonerFactory");
//Class<?> pelletFactoryClass = Class.forName("com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory");
OWLReasonerFactory pelletFactory = (OWLReasonerFactory) pelletFactoryClass.getConstructor().newInstance();
return pelletFactory;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:15,代码来源:IncrementalClassificationMultiDeltasPellet.java
示例18: testImport
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
/**
* Testing loading of ontologies that have no axioms (but possibly import
* declarations).
*
* @see <a
* href="http://code.google.com/p/elk-reasoner/issues/detail?id=7">Issue 7<a>
* @throws OWLOntologyCreationException
* @throws URISyntaxException
*/
@Test
public void testImport() throws OWLOntologyCreationException,
URISyntaxException {
OWLOntologyManager man = TestOWLManager.createOWLOntologyManager();
// loading the root ontology
OWLOntology root = loadOntology(man, "root.owl");
// Create an ELK reasoner.
OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
OWLReasoner reasoner = reasonerFactory.createReasoner(root);
try {
// statistics about the root ontology
assertEquals(root.getAxiomCount(), 0);
// all two ontologies should be in the closure
assertEquals(root.getImportsClosure().size(), 2);
// all axioms from two ontologies should be in the closure
assertEquals(getAxioms(root).size(), 0);
// reasoner queries -- all subclasses are there
reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
} finally {
reasoner.dispose();
}
}
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:38,代码来源:EmptyImportTest.java
示例19: testBufferingReasoner
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
@Test
public void testBufferingReasoner() throws OWLOntologyCreationException {
prepare();
OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
reasoner = reasonerFactory.createReasoner(ont);
testReasoner();
}
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:8,代码来源:BaseOWLAPILowLevelIncrementalClassTest.java
示例20: testNonBufferingReasoner
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; //导入依赖的package包/类
@Test
public void testNonBufferingReasoner() throws OWLOntologyCreationException {
prepare();
OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
reasoner = reasonerFactory.createNonBufferingReasoner(ont);
testReasoner();
}
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:8,代码来源:BaseOWLAPILowLevelIncrementalClassTest.java
注:本文中的org.semanticweb.owlapi.reasoner.OWLReasonerFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论