rdf4j

Most efficient way to clear a named graph?

旧时模样 提交于 2021-01-03 05:45:41
问题 I am working with an instance of Ontotext GraphDB and often want to clear a named graph with a large number of triples. Currently, my technique involves issuing a SPARQL command to the graph server, which searches and matches a triple pattern of every triple in the named graph: DELETE { GRAPH example:exampleGraph { ?s ?p ?o }} WHERE {?s ?p ?o .} When there are a lot of triples, this approach often takes quite some time to clear the named graph. I am wondering whether there is a more efficient

Most efficient way to clear a named graph?

只谈情不闲聊 提交于 2021-01-03 05:45:40
问题 I am working with an instance of Ontotext GraphDB and often want to clear a named graph with a large number of triples. Currently, my technique involves issuing a SPARQL command to the graph server, which searches and matches a triple pattern of every triple in the named graph: DELETE { GRAPH example:exampleGraph { ?s ?p ?o }} WHERE {?s ?p ?o .} When there are a lot of triples, this approach often takes quite some time to clear the named graph. I am wondering whether there is a more efficient

How to load a gzipped rdf file to rdf4j Repository?

北城以北 提交于 2019-12-31 04:22:32
问题 I want to load a gzipped rdf file into a org.eclipse.rdf4j.repository.Repository . During the upload, status messages must be logged to the console. The size of my rdf file is ~1GB of uncompressed or ~50MB of compressed data. 回答1: Actually an RDF4J repository will automatically process a compressed (zip/gzip) file correctly, already. So you can simply do this: RepositoryConnection conn = ... ; // your store connection conn.add(new File("file.zip"), null, RDFFormat.NTRIPLES): If you want to

RDF4J Workbench: Why is One SPIN Constructor Very Slow?

女生的网名这么多〃 提交于 2019-12-24 08:00:36
问题 I apologize for the length of this posting. I am trying to make this slow rule issue reproducible. I'm using TopBraid Composer FE to create an RDF file with ontology and SPIN constructors. He purpose of the SPIN constructors is to check for compliance in the instantiations of individuals of classes defined in the ontology. I find that the execution of the SPIN constructor is very slow, and I'd like to know why. Ontology Including SPIN Constructors SXXIComplianceCheck18.rdf I Modify/Clear my

Are typed literals “tricky” in RDF4J?

心不动则不痛 提交于 2019-12-24 00:59:45
问题 In RDF, I can have an entity that is bound by a single property to multiple literal values. Those values can also be typed to add clarity. :dumpTruck :weight "heavy"^^xsd:string . :dumpTruck :weight "36000"^^xsd:integer . In SPARQL, I can query for just they type I want SELECT ?w WHERE { :dumpTruck :weight ?w FILTER ( datatype(?w) = xsd:integer ) } Is there something like getStatement in RDF4J that can be constrained by datatype like that? 回答1: There's no a priori constraint possible, but you

RDF4j .ttl file filter IF statement

给你一囗甜甜゛ 提交于 2019-12-13 08:41:31
问题 I am having problem during compilation. Can you help to figure out the problem please? ` public static void main(String[] args) throws IOException { File dir = new File("C:data\\test"); String[] fileNames = dir.list(); FileWriter outFile = new FileWriter("out.ttl"); RDFWriter writer = org.eclipse.rdf4j.rio.Rio.createWriter(RDFFormat.TURTLE, outFile ); writer.startRDF(); for (String fileName : fileNames) { System.out.println("Reading from " + fileName); File f = new File(dir, fileName); Model

Merge RDF .ttl files into one file database - filtering and keeping only the data/triples needed

梦想与她 提交于 2019-12-13 04:18:47
问题 I need to merge 1000+ .ttl files into one file database. How can I merge them with filtering the data in the source files and keep only the data needed in the target file? Thanks 回答1: There's a number of options, but the simplest way is probably to have use a Turtle parser to read all the files, and let that parser pass its output to a handler which does the filtering before in turn passing the data to a Turtle writer. Something like this would probably work (using RDF4J): RDFWriter writer =

Jena alternative of ModelBuilder in RDF4J

风流意气都作罢 提交于 2019-12-11 16:45:48
问题 Is there some Interface available in Apache Jena like ModelBuilder in RDF4J? I can see ModelMaker in Jena but that is not something similar to builder I suppose. Following is the function using rdf4j that need to be implemented in Jena: public static org.eclipse.rdf4j.model.Model convertGraph2RDFModel(Graph graph, String label) { ModelBuilder builder = new ModelBuilder(); GraphTraversalSource t = graph.traversal(); GraphTraversal<Vertex, Vertex> hasLabel = t.V().hasLabel(label); Vertex s; if

RDF4j ParsedQuery or TupleExpr to String Represenation

半腔热情 提交于 2019-12-11 07:23:57
问题 I have a SPARQL query and I want to replace some of the URIs it contains based on a dictionary. I constructed a AbstractQueryModelVisitor that does that, i.e., it substitutes the URIs I want. But once they are substituted, I'm not sure how to get back the string representation of the SPARQL query. I only have the ParsedQuery or TupleExpr of it. Is it possible to convert these representations back to a String representation? Thank you 回答1: There is a SPARQLQueryRenderer class which can convert

RDF4J Workbench Add RDF: How do I add multiple files?

陌路散爱 提交于 2019-12-11 04:59:31
问题 I'm using RDF4J Workbench 2.1.2. System Information Application Information Application Name RDF4J Workbench Version 2.1.2 Runtime Information Operating System Windows 10 10.0 (amd64) Java Runtime Oracle Corporation Java HotSpot(TM) 64-Bit Server VM (1.8.0_111) Process User gwcox Memory Used 315 MB Maximum 889 MB I have a set of RDF files containing ontologies I'm working on. Some RDF files import others. For example, my instantiations ontology/RDF file imports the several ontologies defining