OCEL la = new OCEL(lp, rc); for(KnowledgeSource ks: tmp){ ks.init();
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); }
ks.init(); logger.debug("finished initializing knowledge source");
ks.init(); logger.debug("finished initializing knowledge source");
ks.init(); logger.debug("finished initializing knowledge source");
ks.init(); logger.debug("finished initializing knowledge source");
@Test public void test4() throws ComponentInitException, ParseException, IOException { Logger logger = Logger.getRootLogger(); logger.setLevel(Level.TRACE); SimpleLayout layout = new SimpleLayout(); FileAppender app = new FileAppender(layout, "log/el/log.txt", false); logger.removeAllAppenders(); logger.addAppender(app); String ont = "../test/galen2.owl"; KnowledgeSource source = new OWLFile(ont); source.init(); AbstractReasonerComponent reasoner = new OWLAPIReasoner(Collections.singleton(source)); reasoner.init(); System.out.println("Galen loaded."); // Description input = KBParser.parseConcept("(\"http://www.co-ode.org/ontologies/galen#15.0\" AND (\"http://www.co-ode.org/ontologies/galen#30.0\" AND (EXISTS \"http://www.co-ode.org/ontologies/galen#Attribute\".\"http://www.co-ode.org/ontologies/galen#5.0\" AND EXISTS \"http://www.co-ode.org/ontologies/galen#Attribute\".\"http://www.co-ode.org/ontologies/galen#6.0\")))"); OWLClassExpression input = KBParser.parseConcept("(\"http://www.co-ode.org/ontologies/galen#1.0\" AND (\"http://www.co-ode.org/ontologies/galen#10.0\" AND (EXISTS \"http://www.co-ode.org/ontologies/galen#DomainAttribute\".(\"http://www.co-ode.org/ontologies/galen#1.0\" AND (\"http://www.co-ode.org/ontologies/galen#6.0\" AND \"http://www.co-ode.org/ontologies/galen#TopCategory\")) AND EXISTS \"http://www.co-ode.org/ontologies/galen#Attribute\".(\"http://www.co-ode.org/ontologies/galen#1.0\" AND (\"http://www.co-ode.org/ontologies/galen#TopCategory\" AND EXISTS \"http://www.co-ode.org/ontologies/galen#Attribute\".TOP)))))"); input = ConceptTransformation.cleanConcept(input); ELDown operator = new ELDown(reasoner); operator.init(); operator.refine(input); }
ks.init(); logger.info("finished initializing knowledge source");
@Test public void asTest() throws ComponentInitException, MalformedURLException { String ont = "../test/galen2.owl"; KnowledgeSource source = new OWLFile(ont); source.init(); AbstractReasonerComponent reasoner = new OWLAPIReasoner(Collections.singleton(source)); reasoner.init(); System.out.println("Galen loaded."); ELDescriptionTree tree = new ELDescriptionTree(reasoner); OWLClass a1 = new OWLClassImpl(IRI.create("http://www.co-ode.org/ontologies/galen#1.0")); OWLClass a2 = new OWLClassImpl(IRI.create("http://www.co-ode.org/ontologies/galen#10.0")); OWLClass a3 = new OWLClassImpl(IRI.create("http://www.co-ode.org/ontologies/galen#6.0")); OWLClass a4 = new OWLClassImpl(IRI.create("http://www.co-ode.org/ontologies/galen#TopCategory")); OWLObjectProperty r1 = new OWLObjectPropertyImpl(IRI.create("http://www.co-ode.org/ontologies/galen#Attribute")); OWLObjectProperty r2 = new OWLObjectPropertyImpl(IRI.create("http://www.co-ode.org/ontologies/galen#DomainAttribute")); ELDescriptionNode v1 = new ELDescriptionNode(tree, a1, a2); ELDescriptionNode v2 = new ELDescriptionNode(v1, r2, a1, a3, a4); ELDescriptionNode v3 = new ELDescriptionNode(v1, r1, a1, a4); new ELDescriptionNode(v3, r1); ELDescriptionNode w = new ELDescriptionNode(v2, r1); ELDown operator = new ELDown(reasoner); operator.init(); System.out.println(operator.asCheck(w)); }
schemaKS.init();