public IndividualBasedFragmentExtractor(SparqlEndpointKS ks, int maxNrOfIndividuals) { this.maxNrOfIndividuals = maxNrOfIndividuals; cbdGen = new ConciseBoundedDescriptionGeneratorImpl(ks.getQueryExecutionFactory()); }
private OWLOntology extractSampleModule(String resource){ logger.info("Extracting sample module..."); long startTime = System.currentTimeMillis(); ConciseBoundedDescriptionGenerator cbdGen = new ConciseBoundedDescriptionGeneratorImpl(ks.getQueryExecutionFactory()); Model model = cbdGen.getConciseBoundedDescription(resource, 3); OWLOntology data = convert(model); logger.info("...done in " + (System.currentTimeMillis()-startTime) + "ms."); return data; }
private Model getFragmentMultithreaded(final SparqlEndpointKS ks, Set<OWLIndividual> individuals){ Model model = ModelFactory.createDefaultModel(); ExecutorService threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); List<Future<Model>> futures = new ArrayList<>(); for (final OWLIndividual ind : individuals) { futures.add(threadPool.submit(new Callable<Model>() { @Override public Model call() throws Exception { ConciseBoundedDescriptionGenerator cbdGen = new ConciseBoundedDescriptionGeneratorImpl(ks.getQueryExecutionFactory()); return cbdGen.getConciseBoundedDescription(ind.toStringID(), 2); } })); } for (Future<Model> future : futures) { try { model.add(future.get()); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } threadPool.shutdown(); return model; }
public QTLTuples(QueryExecutionFactory qef) { this.qef = qef; cbdGen = new ConciseBoundedDescriptionGeneratorImpl(qef); treeFactory = new QueryTreeFactoryBase(); lggGenerator = new LGGGeneratorSimple(); }
private OWLOntology extractSampleModule(Set<String> resources){ logger.info("Extracting sample module..."); long startTime = System.currentTimeMillis(); ConciseBoundedDescriptionGenerator cbdGen = new ConciseBoundedDescriptionGeneratorImpl(ks.getQueryExecutionFactory()); Model model = ModelFactory.createDefaultModel(); for(String resource : resources){ model.add(cbdGen.getConciseBoundedDescription(resource, depth)); } logger.info("...done in " + (System.currentTimeMillis()-startTime) + "ms."); return convert(model); }
public AbstractSampleGenerator(QueryExecutionFactory qef) { this.qef = qef; cbdGen = new ConciseBoundedDescriptionGeneratorImpl(qef); cbdGen.setIgnoredProperties(Sets.newHashSet(OWL.sameAs.getURI())); reasoner = new SPARQLReasoner(qef); }
public static void main(String[] args) { SparqlEndpoint endpoint = SparqlEndpoint.getEndpointDBpedia(); Set<String> ignoredProperties = Sets.newHashSet( "http://dbpedia.org/ontology/abstract", "http://dbpedia.org/ontology/wikiPageID", "http://dbpedia.org/ontology/wikiPageRevisionID", "http://dbpedia.org/ontology/wikiPageID"); ConciseBoundedDescriptionGenerator cbdGen = new ConciseBoundedDescriptionGeneratorImpl(endpoint); // cbdGen.setIgnoredProperties(ignoredProperties); // cbdGen.setAllowedPropertyNamespaces(Sets.newHashSet("http://dbpedia.org/ontology/")); // cbdGen.setAllowedClassNamespaces(Sets.newHashSet("http://dbpedia.org/ontology/")); // cbdGen.setAllowedObjectNamespaces(Sets.newHashSet("http://dbpedia.org/resource/")); cbdGen = new CachingConciseBoundedDescriptionGenerator(cbdGen); // cbdGen.setRestrictToNamespaces(Arrays.asList(new String[]{"http://dbpedia.org/ontology/", RDF.getURI(), RDFS.getURI()})); Model cbd = cbdGen.getConciseBoundedDescription(Sets.newHashSet("http://dbpedia.org/resource/Leipzig", "http://dbpedia.org/resource/Dresden"),2); System.out.println(cbd.size()); }
@Override public Model call() throws Exception { ConciseBoundedDescriptionGenerator cbdGen = new ConciseBoundedDescriptionGeneratorImpl(ks.getQueryExecutionFactory()); return cbdGen.getConciseBoundedDescription(ind.toStringID(), 2); } }));
private Model getFragment(SparqlEndpointKS ks, Set<OWLIndividual> individuals){ ConciseBoundedDescriptionGenerator cbdGen = new ConciseBoundedDescriptionGeneratorImpl(ks.getQueryExecutionFactory()); Model model = ModelFactory.createDefaultModel(); for(OWLIndividual ind : individuals){ Model cbd = cbdGen.getConciseBoundedDescription(ind.toStringID(), 2); model.add(cbd); } return model; }
treeFactory = new QueryTreeFactoryBase(); cbdGen = new ConciseBoundedDescriptionGeneratorImpl(qef);
treeFactory = new QueryTreeFactoryBase(); cbdGen = new ConciseBoundedDescriptionGeneratorImpl(qef);
public static void main(String[] args) throws Exception { QueryTreeFactory factory = new QueryTreeFactoryBase(); factory.setMaxDepth(2); factory.addDropFilters( new PredicateDropStatementFilter(Sets.union(Sets.union(StopURIsDBpedia.get(), StopURIsRDFS.get()), StopURIsOWL.get())), new ObjectDropStatementFilter(StopURIsOWL.get()), new NamespaceDropStatementFilter( Sets.newHashSet( "http://dbpedia.org/property/", "http://purl.org/dc/terms/", "http://dbpedia.org/class/yago/", FOAF.getURI() ) ) ); ConciseBoundedDescriptionGenerator cbdGen = new ConciseBoundedDescriptionGeneratorImpl( SparqlEndpoint.getEndpointDBpedia()); String resourceURI = "http://dbpedia.org/resource/Athens"; Model cbd = cbdGen.getConciseBoundedDescription(resourceURI, 2); RDFResourceTree queryTree = factory.getQueryTree(resourceURI, cbd); System.out.println(queryTree.getStringRepresentation()); System.out.println(QueryTreeUtils.toSPARQLQuery(queryTree)); }
cbdGen = new ConciseBoundedDescriptionGeneratorImpl(qef); cbdGen = new SymmetricConciseBoundedDescriptionGeneratorImpl(qef);
public BiomedicalLearningProblemsGenerator(File benchmarkDirectory, int threadCount) throws Exception { this.benchmarkDirectory = benchmarkDirectory; this.threadCount = threadCount; Model model = RDFDataMgr.loadModel("file:/home/user/work/experiments/qtl/data/biomedical/drugbank_dump.nt", Lang.NTRIPLES); schema = ModelFactory.createDefaultModel(); schema.read(new FileInputStream(new File("/home/user/work/experiments/qtl/data/biomedical/", "drugbank.schema.owl")), null, "RDF/XML"); schema.write(System.out, "TURTLE"); model.add(schema); ks = new LocalModelBasedSparqlEndpointKS(model); ks.setUseCache(true); ks.setQueryDelay(100); ks.init(); reasoner = new SPARQLReasoner(ks); reasoner.init(); cbdGen = new ConciseBoundedDescriptionGeneratorImpl(ks.getQueryExecutionFactory()); dataDir = new File(benchmarkDirectory, "data/biomedical/"); dataDir.mkdirs(); }
"http://dbpedia.org/ontology/wikiPageExternalLink"); ConciseBoundedDescriptionGenerator cbdGen = new ConciseBoundedDescriptionGeneratorImpl(ks.getQueryExecutionFactory()); cbdGen.setIgnoredProperties(ignoredProperties); cbdGen.setAllowedPropertyNamespaces(Sets.newHashSet("http://dbpedia.org/ontology/"));
ConciseBoundedDescriptionGenerator cbdGenerator = new ConciseBoundedDescriptionGeneratorImpl(qef); int maxDepth = 2;
ConciseBoundedDescriptionGenerator cbdGen = new ConciseBoundedDescriptionGeneratorImpl(qef); cbdGen.setIgnoredProperties(ignoredProperties); cbdGen.setAllowedPropertyNamespaces(Sets.newHashSet("http://dbpedia.org/ontology/"));
reasoner.prepareSubsumptionHierarchy(); ConciseBoundedDescriptionGenerator cbdGen = new ConciseBoundedDescriptionGeneratorImpl(qef);
@Before public void setUp() throws Exception { String kb = "" + "@prefix : <http://dl-learner.org/test/> ." + "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> ." + "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> ." + ":x1 :r :y1 ." + ":x2 rdf:type :A ." + ":r rdfs:domain :A ." + ":x3 :s :y2 ." + ":x4 rdf:type :B ." + ":s rdfs:domain :C ." + ":B rdfs:subClassOf :C ." + ":x5 :t :y3 ." + ":y3 rdf:type :B ." + ":x6 :t :y4 ." + ":t rdfs:range :C ." + ":B rdfs:subClassOf :C ."; Model model = ModelFactory.createDefaultModel(); RDFDataMgr.read(model, new StringReader(kb), null, Lang.TURTLE); SparqlEndpointKS ks = new LocalModelBasedSparqlEndpointKS(model); ks.init(); AbstractReasonerComponent reasoner = new SPARQLReasoner(ks); reasoner.setPrecomputeClassHierarchy(true); reasoner.init(); cbdGenerator = new ConciseBoundedDescriptionGeneratorImpl(ks.getQueryExecutionFactory()); treeFactory = new QueryTreeFactoryBase(); lggGen = new LGGGeneratorRDFS(reasoner); }
cbdGen = new ConciseBoundedDescriptionGeneratorImpl(qef);