Hi,
I would like to use Fuseki to handle SPARQL queries over an inferred
graph, but am running into some memory issues. At the moment, I start
up a Fuseki service using a config file that contains:
<#dataset> rdf:type ja:RDFDataset ;
rdfs:label "ds" ;
ja:defaultGraph <#inferenceModel> .
<#inferenceModel> rdf:type ja:InfModel;
ja:baseModel <#baseModel>;
ja:content [ja:externalContent
<<file:///data/solo/databases/test_facts.ttl>> ] ;
ja:reasoner [ja:reasonerURL
<<http://jena.hpl.hp.com/2003/GenericRuleReasoner>> ;
ja:rulesFrom <<file:///data/solo/databases/test.rules>> ;
];
.
<#baseModel> rdf:type tdb2:GraphTDB2;
tdb2:location "/data/solo/databases/" ;
.
This makes an inference model using the GenericRuleReasoner from the
files test.rules and test_facts.ttl.
However, it ends up using a lot of memory and I am having difficulty
understanding why. As a test, I only included the following facts in
test_facts.ttl:
@prefix rdf: <<http://www.w3.org/1999/02/22-rdf-syntax-ns#>> .
@prefix rdfs: <<http://www.w3.org/2000/01/rdf-schema#>> .
@prefix owl: <<http://www.w3.org/2002/07/owl#>> .
@prefix skos: <<http://www.w3.org/2004/02/skos/core#>> .
@prefix : <<http://example.org/>> .
:testBNode rdfs:type owl:Class .
:FirstTestBNode a :testBNode;
:testNumber 1 .
And the following (single) rule in test.rules:
[lotsOfBlankNodes:
(?testBNode rdf:type :testBNode)
(?testBNode hx:testNumber ?num)
lessThan(?num, 1000000)
addOne(?num, ?next_num)
makeSkolem(?next_testBNode, ?next_num)
->
(?next_testBNode rdf:type :testBNode)
(?next_testBNode :testNumber ?next_num)
]
When I start Fuseki, this uses forward-chaining to materialise about 2
million triples. When I look at my system monitor, it creates a java
process that takes 6.3 GB of memory. A quick back of the napkin
calculation means that, for each triple, about 3.2 kB is needed.
Comparing that to the actual information stored in each triple (which
is on the order of bytes), this seems at least 1000 times too large.
Is there something wrong in the way that Fuseki is configured that is
causing it to use such large amounts of memory?
Thank you in advance for your help-
Kindest regards,
Laurent