public OWLAPIReasoner(OWLReasoner reasoner) { this.reasoner = reasoner; KnowledgeSource ks = new OWLAPIOntology(reasoner.getRootOntology()); sources = Collections.singleton(ks); }
public AnnotationEntityTextRetriever(OWLAPIOntology ontology, OWLAnnotationProperty... properties) { this.ontology = ontology.createOWLOntology(manager); }
private void loadModel(){ model = ModelFactory.createDefaultModel(); for (KnowledgeSource ks : reasoner.getSources()) { if(ks instanceof OWLFile){ try { model.read(((OWLFile) ks).getURL().openStream(), null); } catch (IOException e) { e.printStackTrace(); } } else if(ks instanceof OWLAPIOntology){ ByteArrayInputStream bais = new ByteArrayInputStream(((OWLAPIOntology) ks).getConverter().convert(((OWLAPIOntology) ks).getOntology())); model.read(bais, null); try { bais.close(); } catch (IOException e) { e.printStackTrace(); } } } }
OWLAPIOntology ks = new OWLAPIOntology(ontology); ks.init();
@Test public void testMethods() throws Exception { OWLOntology ontology = createOntology(); assertNotNull(ontology); OWLAPIOntology testSubject = new OWLAPIOntology(ontology); OWLOntology result = testSubject.createOWLOntology(OWLManager.createOWLOntologyManager()); assertNotNull(result); assertNotSame(ontology,result); // Basic Equality Check - for some reason axiom count is different - the result looks more complete than the original. assertEquals(ontology.getIndividualsInSignature().size(), result.getIndividualsInSignature().size()); } }
OWLAPIOntology ks = new OWLAPIOntology(ontology); ks.init();
public void changeSourcesOntology(OWLOntology ontology) { sourcesOntology = ontology; learningProblem.getReasoner().changeSources(Collections.singleton((KnowledgeSource) new OWLAPIOntology(ontology))); // learningProblem.getReasoner().changeSources(Collections.singleton((KnowledgeSource) ontology)); }
private void loadModel(){ model = ModelFactory.createDefaultModel(); for (KnowledgeSource ks : reasoner.getSources()) { if(ks instanceof OWLFile){ try { model.read(((OWLFile) ks).getURL().openStream(), null); } catch (IOException e) { e.printStackTrace(); } } else if(ks instanceof OWLAPIOntology){ ByteArrayInputStream bais = new ByteArrayInputStream(((OWLAPIOntology) ks).getConverter().convert(((OWLAPIOntology) ks).getOntology())); model.read(bais, null); try { bais.close(); } catch (IOException e) { e.printStackTrace(); } } } }
public void changeSourcesOntology(OWLOntology ontology) { sourcesOntology = ontology; edge.setOntologies(ontology); learningProblem.getReasoner().changeSources(Collections.singleton((KnowledgeSource) new OWLAPIOntology(ontology))); // learningProblem.getReasoner().changeSources(Collections.singleton((KnowledgeSource) ontology)); }
public static void main(String[] args) throws Exception { OWLOntologyManager man = OWLManager.createOWLOntologyManager(); OWLOntology schema = //man.loadOntology(IRI.create("http://downloads.dbpedia.org/2016-10/dbpedia_2016-10.nt")); man.loadOntology(IRI.create("file:///tmp/merged.ttl")); OWLOntologyKnowledgeSource sampleKS = new OWLAPIOntology(schema); sampleKS.init(); final long start = System.currentTimeMillis(); OWLAPIReasoner baseReasoner = new OWLAPIReasoner(sampleKS); baseReasoner.setReasonerImplementation(ReasonerImplementation.STRUCTURAL); baseReasoner.init(); ClosedWorldReasoner reasoner = new ClosedWorldReasoner(baseReasoner); reasoner.init(); System.out.println(PeriodFormat.getDefault().print(new Period(System.currentTimeMillis() - start))); }
AbstractReasonerComponent rc = new ClosedWorldReasoner(new OWLAPIOntology(fragment)); rc.init();
ontology.getOWLOntologyManager().addAxioms(ontology, reasoner.getClassHierarchy().toOWLAxioms()); ksFragment = new OWLAPIOntology(ontology); try { OWLManager.createOWLOntologyManager().saveOntology(ontology, new TurtleDocumentFormat(), new FileOutputStream("/tmp/test.ttl"));
KnowledgeSource ks = new OWLAPIOntology(ontology); ks.init(); logger.debug("finished initializing knowledge source");
private static void setup(String turtleString) throws Exception{ OWLOntology ontology = OWLManager.createOWLOntologyManager().loadOntologyFromOntologyDocument( new ByteArrayInputStream(turtleString.getBytes(StandardCharsets.UTF_8))); KnowledgeSource ks = new OWLAPIOntology(ontology); ks.init(); reasoner = new OWLAPIReasoner(ks); reasoner.init(); // get examples Set<OWLIndividual> posExamples = new HashSet<>(); Set<OWLIndividual> negExamples = new HashSet<>(); for (OWLIndividual ind : ontology.getIndividualsInSignature()) { if (ind.toStringID().startsWith("http://example.org/p")) { posExamples.add(ind); } else { negExamples.add(ind); } } // create learning problem lp = new PosNegLPStandard(reasoner); lp.setPositiveExamples(posExamples); lp.setNegativeExamples(negExamples); }
KnowledgeSource ks = new OWLAPIOntology(ontology); ks.init(); logger.debug("finished initializing knowledge source");
KnowledgeSource ks = new OWLAPIOntology(ontology); ks.init(); logger.debug("finished initializing knowledge source");
KnowledgeSource ks = new OWLAPIOntology(ontology); ks.init(); logger.debug("finished initializing knowledge source");
@Before public void setUp() throws Exception { reasoner = new OWLAPIReasoner(); reasoner.setSources(new OWLAPIOntology(OWLManager.createOWLOntologyManager().loadOntologyFromOntologyDocument( new File("src/test/resources/org/dllearner/utilities/property_hierarchy.ttl")))); reasoner.init(); df = new OWLDataFactoryImpl(); pm = new DefaultPrefixManager(); pm.setDefaultPrefix("http://www.dl-learner.org/test/hierarchy/properties#"); }
TestRunner(String prefix, String owlfile, OWLDatatype restrictionType, int maxNrOfSplits) throws OWLOntologyCreationException, ComponentInitException { this.prefix = prefix; this.restrictionType = restrictionType; this.maxNrOfSplits = maxNrOfSplits; // StringRenderer.setRenderer(Rendering.MANCHESTER_SYNTAX); // StringRenderer.setRenderer(Rendering.DL_SYNTAX); File file = new File(owlfile); OWLOntology ontology = OWLManager.createOWLOntologyManager().loadOntologyFromOntologyDocument(file); df = new OWLDataFactoryImpl(); pm = new DefaultPrefixManager(); pm.setDefaultPrefix(prefix); ks = new OWLAPIOntology(ontology); ks.init(); } TestRunner(String prefix, String owlfile, OWLDatatype restrictionType) throws OWLOntologyCreationException, ComponentInitException {
KnowledgeSource ks = new OWLAPIOntology(module); ks.init(); logger.info("finished initializing knowledge source");