Clone URL (Committers only): https://cms.apache.org/redirect?new=anonymous;action=diff;uri=http://jena.apache.org/documentation%2Ftdb%2Fdatasets.mdtext
Greg Albiston Index: trunk/content/documentation/tdb/datasets.mdtext =================================================================== --- trunk/content/documentation/tdb/datasets.mdtext (revision 1833775) +++ trunk/content/documentation/tdb/datasets.mdtext (working copy) @@ -51,6 +51,51 @@ ... } +### Named Graphs & Filters + +Named graphs provide a convenient way to organise and store your data. +However, be aware that in certain situations named graphs can make it difficult for the query optimiser. + +For example, a query with the following structure took 29 minutes to complete: + + SELECT ?b ... + WHERE { + + GRAPH dataset:BigA { + ?a rdf:type my:AThing. + ?a noa:hasGeometry ?aData. + ... + } + + GRAPH dataset:SmallB { + ?b rdf:type my:BThing. + ?b my:hasData ?bData. + ... + } + + FILTER(my:filterFunction1(?bData, ?aData)) + FILTER(my:filterFunction2(?bData, "1.0 3.0, 4.0 2.0"^^my:dataLiteral) ) + + } + +The completion duration was reduced to 7 seconds by applying the global TDB.symUnionDefaultGraph option (see above) to the dataset and modifying the query as follows: + + SELECT ?b ... + WHERE { + + ?a rdf:type my:AThing. + ?a noa:hasGeometry ?aData. + ... + + ?b rdf:type my:BThing. + ?b my:hasData ?bData. + ... + + FILTER(my:filterFunction1(?bData, ?aData)) + FILTER(my:filterFunction2(?bData, "1.0 3.0, 4.0 2.0"^^my:dataLiteral) ) + + } + ## Special Graph Names URI | Meaning