public Enrichment(SparqlEndpoint se, OWLEntity resource, double threshold, int nrOfAxiomsToLearn, boolean useInference, boolean verbose, int chunksize, int maxExecutionTimeInSeconds, boolean omitExistingAxioms) { this(new SparqlEndpointKS(se), resource, threshold, nrOfAxiomsToLearn, useInference, verbose, chunksize, maxExecutionTimeInSeconds, omitExistingAxioms); }
public SPARQLEndpointMetrics(SparqlEndpoint endpoint, ExtractionDBCache cache) { this.endpoint = endpoint; this.cache = cache; cache.setFreshnessInMilliseconds(Long.MAX_VALUE);//31536000000l); cache.setMaxExecutionTimeInSeconds(300); this.reasoner = new SPARQLReasoner(new SparqlEndpointKS(endpoint), cache); }
public SPARQLEndpointMetrics(Knowledgebase knowledgebase, ExtractionDBCache cache) { this.endpoint = ((RemoteKnowledgebase)knowledgebase).getEndpoint(); this.cache = cache; cache.setFreshnessInMilliseconds(Long.MAX_VALUE);//31536000000l); cache.setMaxExecutionTimeInSeconds(300); this.reasoner = new SPARQLReasoner(new SparqlEndpointKS(endpoint), cache); }
public static void main(String[] args) throws Exception { OWLDataFactory df = new OWLDataFactoryImpl(); AsymmetricObjectPropertyAxiomLearner l = new AsymmetricObjectPropertyAxiomLearner(new SparqlEndpointKS( new SparqlEndpoint(new URL("http://live.dbpedia.org/sparql"), Collections.singletonList("http://dbpedia.org"), Collections.<String> emptyList())));// .getEndpointDBpediaLiveAKSW())); l.setEntityToDescribe(df.getOWLObjectProperty(IRI.create("http://dbpedia.org/ontology/spouse"))); l.setMaxExecutionTimeInSeconds(10); l.init(); l.start(); System.out.println(l.getCurrentlyBestEvaluatedAxioms(5)); } }
public SimpleRankingComputation(Knowledgebase knowledgebase) { super(knowledgebase); if(knowledgebase instanceof RemoteKnowledgebase) {reasoner = new SPARQLReasoner(new SparqlEndpointKS(((RemoteKnowledgebase)knowledgebase).getEndpoint()));} else {reasoner = new SPARQLReasoner(new LocalModelBasedSparqlEndpointKS(((LocalKnowledgebase)knowledgebase).getModel()));} // metrics = new SPARQLEndpointMetrics(((RemoteKnowledgebase) knowledgebase).getEndpoint(), new ExtractionDBCache("/opt/tbsl/dbpedia_pmi_cache_v2")); }
public static void main(String[] args) throws Exception{ CELOEWrapper la = new CELOEWrapper(new SparqlEndpointKS(SparqlEndpoint.getEndpointDBpediaLiveAKSW())); la.setEntityToDescribe(new OWLClassImpl(IRI.create("http://dbpedia.org/ontology/Book"))); la.init(); la.start(); // new CELOEWrapper(new SparqlEndpointKS(SPARqlend)) }
public static void main(String[] args) throws Exception { TransitiveObjectPropertyAxiomLearner l = new TransitiveObjectPropertyAxiomLearner(new SparqlEndpointKS( SparqlEndpoint.getEndpointDBpediaLiveAKSW())); l.setEntityToDescribe(new OWLObjectPropertyImpl(IRI.create("http://dbpedia.org/ontology/birthPlace"))); l.setMaxExecutionTimeInSeconds(5); l.init(); l.start(); List<EvaluatedAxiom<OWLTransitiveObjectPropertyAxiom>> axioms = l.getCurrentlyBestEvaluatedAxioms(5, 0.0); System.out.println(axioms); for (EvaluatedAxiom<OWLTransitiveObjectPropertyAxiom> axiom : axioms) { l.explainScore(axiom); } }
public SPARQLSampleDebugging(SparqlEndpoint endpoint) { this.endpoint = endpoint; this.ks = new SparqlEndpointKS(endpoint); initDBConnection(); dbpediaOntology = loadDBpediaOntology(); dbpediaReasoner = PelletReasonerFactory.getInstance().createNonBufferingReasoner(dbpediaOntology); dbpediaReasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY); }
public static void main(String[] args) throws Exception { InverseFunctionalObjectPropertyAxiomLearner l = new InverseFunctionalObjectPropertyAxiomLearner(new SparqlEndpointKS( SparqlEndpoint.getEndpointDBpediaLiveAKSW())); l.setEntityToDescribe(new OWLDataFactoryImpl().getOWLObjectProperty(IRI .create("http://dbpedia.org/ontology/birthPlace"))); l.setMaxExecutionTimeInSeconds(5); l.init(); l.start(); List<EvaluatedAxiom<OWLInverseFunctionalObjectPropertyAxiom>> axioms = l.getCurrentlyBestEvaluatedAxioms(5); System.out.println(axioms); for (EvaluatedAxiom<OWLInverseFunctionalObjectPropertyAxiom> axiom : axioms) { l.explainScore(axiom); } } }
public static void main(String[] args) throws Exception { ToStringRenderer.getInstance().setRenderer(new DLSyntaxObjectRenderer()); SparqlEndpointKS ks = new SparqlEndpointKS(SparqlEndpoint.getEndpointDBpedia()); ks.init(); ObjectPropertyDomainAxiomLearner la = new ObjectPropertyDomainAxiomLearner(ks); la.setPropertyToDescribe(new OWLObjectPropertyImpl(IRI.create("http://dbpedia.org/ontology/author"))); la.setUseSampling(false); la.setBatchMode(true); la.setProgressMonitor(new ConsoleAxiomLearningProgressMonitor()); la.init(); la.start(); la.getCurrentlyBestEvaluatedAxioms().forEach(ax -> { System.out.println("---------------\n" + ax); la.getPositiveExamples(ax).stream().limit(5).forEach(System.out::println); }); }
public static void main(String[] args) throws Exception { ToStringRenderer.getInstance().setRenderer(new DLSyntaxObjectRenderer()); SparqlEndpointKS ks = new SparqlEndpointKS(SparqlEndpoint.getEndpointDBpedia()); ks.init(); ObjectPropertyRangeAxiomLearner la = new ObjectPropertyRangeAxiomLearner(ks); la.setPropertyToDescribe(new OWLObjectPropertyImpl(IRI.create("http://dbpedia.org/ontology/author"))); la.setUseSampling(false); la.setBatchMode(true); la.setProgressMonitor(new ConsoleAxiomLearningProgressMonitor()); la.init(); la.start(); la.getCurrentlyBestEvaluatedAxioms().forEach(ax -> { System.out.println("---------------\n" + ax); la.getPositiveExamples(ax).stream().limit(5).forEach(System.out::println); }); } }
public static void main(String[] args) throws Exception { ToStringRenderer.getInstance().setRenderer(new DLSyntaxObjectRenderer()); SparqlEndpointKS ks = new SparqlEndpointKS(SparqlEndpoint.getEndpointDBpedia()); ks.init(); SubObjectPropertyOfAxiomLearner la = new SubObjectPropertyOfAxiomLearner(ks); la.setEntityToDescribe(new OWLObjectPropertyImpl(IRI.create("http://dbpedia.org/ontology/author"))); la.setUseSampling(false); la.setBatchMode(true); la.setProgressMonitor(new ConsoleAxiomLearningProgressMonitor()); la.init(); la.start(); la.getCurrentlyBestEvaluatedAxioms().forEach(ax -> { System.out.println("---------------\n" + ax); la.getPositiveExamples(ax).stream().limit(5).forEach(System.out::println); }); } }
public static void main(String[] args) throws Exception{ ToStringRenderer.getInstance().setRenderer(new DLSyntaxObjectRenderer()); SparqlEndpointKS ks = new SparqlEndpointKS(SparqlEndpoint.getEndpointDBpedia()); ks.init(); DataPropertyDomainAxiomLearner l = new DataPropertyDomainAxiomLearner(ks); l.setEntityToDescribe(new OWLDataPropertyImpl(IRI.create("http://dbpedia.org/ontology/birthDate"))); l.setUseSampling(false); l.setBatchMode(true); l.setUsePrecisionOnly(false); l.setProgressMonitor(new ConsoleAxiomLearningProgressMonitor()); l.init(); l.start(); l.getCurrentlyBestEvaluatedAxioms(0.3).forEach(ax -> { System.out.println("---------------\n" + ax); l.getPositiveExamples(ax).stream().limit(5).forEach(System.out::println); }); }
public static void main(String[] args) throws Exception { SparqlEndpointKS ks = new SparqlEndpointKS(SparqlEndpoint.getEndpointDBpedia()); InverseObjectPropertyAxiomLearner l = new InverseObjectPropertyAxiomLearner(ks); l.setEntityToDescribe(new OWLDataFactoryImpl().getOWLObjectProperty(IRI .create("http://dbpedia.org/ontology/routeEnd"))); l.setMaxExecutionTimeInSeconds(60); // l.setForceSPARQL_1_0_Mode(true); // l.setReturnOnlyNewAxioms(true); l.init(); l.start(); System.out.println(l.getCurrentlyBestEvaluatedAxioms(10, 0.2)); }
public static void main(String[] args) throws Exception { ToStringRenderer.getInstance().setRenderer(new DLSyntaxObjectRenderer()); SparqlEndpointKS ks = new SparqlEndpointKS(SparqlEndpoint.getEndpointDBpedia()); ks.init(); SimpleSubclassLearner la = new SimpleSubclassLearner(ks); la.setEntityToDescribe(new OWLClassImpl(IRI.create("http://dbpedia.org/ontology/Book"))); la.setUseSampling(false); la.setBatchMode(true); la.setStrictOWLMode(true); la.setReturnOnlyNewAxioms(true); la.setProgressMonitor(new ConsoleAxiomLearningProgressMonitor()); la.init(); la.start(); la.getCurrentlyBestEvaluatedAxioms(0.3).forEach(ax -> { System.out.println("---------------\n" + ax); la.getPositiveExamples(ax).stream().limit(5).forEach(System.out::println); }); } }
public static void main(String[] args) throws Exception { FunctionalObjectPropertyAxiomLearner l = new FunctionalObjectPropertyAxiomLearner(new SparqlEndpointKS( SparqlEndpoint.getEndpointDBpedia())); l.setEntityToDescribe(new OWLDataFactoryImpl().getOWLObjectProperty(IRI .create("http://dbpedia.org/ontology/birthPlace"))); l.setMaxExecutionTimeInSeconds(20); l.setForceSPARQL_1_0_Mode(true); l.init(); l.start(); List<EvaluatedAxiom<OWLFunctionalObjectPropertyAxiom>> axioms = l.getCurrentlyBestEvaluatedAxioms(5); System.out.println(axioms); for (EvaluatedAxiom<OWLFunctionalObjectPropertyAxiom> axiom : axioms) { printSubset(l.getPositiveExamples(axiom), 10); printSubset(l.getNegativeExamples(axiom), 10); l.explainScore(axiom); } } }
public static void main(String[] args) throws Exception{ SparqlEndpoint endpoint = SparqlEndpoint.create("http://sake.informatik.uni-leipzig.de:8890/sparql", "http://biomedical.org"); SparqlEndpointKS ks = new SparqlEndpointKS(endpoint); ks.init(); new PredicateExistenceFilterBiomedical().analyze(ks); }
public static void main(String[] args) throws Exception { SparqlEndpointKS ks = new SparqlEndpointKS(SparqlEndpoint.create("http://sake.informatik.uni-leipzig.de:8890/sparql", "http://dbpedia.org")); ks.init(); DisjointClassesLearner la = new DisjointClassesLearner(ks); la.setEntityToDescribe(new OWLClassImpl(IRI.create("http://dbpedia.org/ontology/Actor"))); la.setUseSampling(false); la.init(); la.start(); la.getCurrentlyBestAxioms(10); } }
public void testLearnSingleClass() throws ComponentInitException{ ks = new SparqlEndpointKS(SparqlEndpoint.getEndpointDBpediaLiveAKSW()); ks.init(); reasoner = new SPARQLReasoner(ks); reasoner.init(); DisjointClassesLearner l = new DisjointClassesLearner(ks); l.setReasoner(reasoner); l.setMaxExecutionTimeInSeconds(maxExecutionTimeInSeconds); l.setEntityToDescribe(new OWLClassImpl(IRI.create("http://dbpedia.org/ontology/Book"))); l.init(); l.start(); System.out.println(l.getCurrentlyBestAxioms(5)); }
public void testLearnForMostGeneralClasses() throws ComponentInitException { ks = new SparqlEndpointKS(SparqlEndpoint.getEndpointDBpediaLiveAKSW()); ks.init(); reasoner = new SPARQLReasoner(ks); reasoner.init(); DisjointClassesLearner l = new DisjointClassesLearner(ks); l.setReasoner(reasoner); l.setMaxExecutionTimeInSeconds(maxExecutionTimeInSeconds); l.init(); for(OWLClassExpression cls : reasoner.getClassHierarchy().getMostGeneralClasses()){ l.setEntityToDescribe(cls.asOWLClass()); l.start(); System.out.println(l.getCurrentlyBestAxioms(5)); } }