jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r889970 - in /websites/staging/jena/trunk/content: ./ documentation/query/text-query.html
Date Wed, 11 Dec 2013 10:59:11 GMT
Author: buildbot
Date: Wed Dec 11 10:59:11 2013
New Revision: 889970

Log:
Staging update by buildbot for jena

Modified:
    websites/staging/jena/trunk/content/   (props changed)
    websites/staging/jena/trunk/content/documentation/query/text-query.html

Propchange: websites/staging/jena/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Dec 11 10:59:11 2013
@@ -1 +1 @@
-1549538
+1550104

Modified: websites/staging/jena/trunk/content/documentation/query/text-query.html
==============================================================================
--- websites/staging/jena/trunk/content/documentation/query/text-query.html (original)
+++ websites/staging/jena/trunk/content/documentation/query/text-query.html Wed Dec 11 10:59:11
2013
@@ -159,6 +159,7 @@ the actual label.  More details are give
 <li><a href="#configuration">Configuration</a><ul>
 <li><a href="#text-dataset-assembler">Text Dataset Assembler</a></li>
 <li><a href="#configuration-by-code">Configuration by Code</a></li>
+<li><a href="#graph-specific-indexing">Graph-specific Indexing</a></li>
 </ul>
 </li>
 <li><a href="#working-with-fuseki">Working with Fuseki</a></li>
@@ -178,11 +179,11 @@ or
 properties work with.  When data is added, any properties matching the
 description caus an entry to be added from analysed text from the triple
 object and mapping to the subject.</p>
-<h3 id="pattern-a-wzxhzdk15-rdf-data">Pattern A &ndash; RDF data</h3>
+<h3 id="pattern-a-wzxhzdk17-rdf-data">Pattern A &ndash; RDF data</h3>
 <p>In this pattern, the data in the text index is indexing literals in the RDF data.<br
/>
 Additions to the RDF data are reflected in additions to the index.</p>
 <p>(Deletes do not remove text index entries - <a href="#deletion">see below</a>)</p>
-<h3 id="pattern-b-wzxhzdk16-external-content">Pattern B &ndash; External content</h3>
+<h3 id="pattern-b-wzxhzdk18-external-content">Pattern B &ndash; External content</h3>
 <p>There is no requirement that the text data indexed is present in the RDF
 data.  As long as the index contains the index text documents to match the
 index description, then text search can be performed.</p>
@@ -245,7 +246,7 @@ surrounding <code>( )</code> can be omit
 <h3 id="good-practice">Good practice</h3>
 <p>The query execution does not know the selectivity of the text index.  It is
 better to use one of two styles.</p>
-<h4 id="query-pattern-1-wzxhzdk17-find-in-the-text-index-and-enhance-results">Query
pattern 1 &ndash; Find in the text index and enhance results</h4>
+<h4 id="query-pattern-1-wzxhzdk19-find-in-the-text-index-and-enhance-results">Query
pattern 1 &ndash; Find in the text index and enhance results</h4>
 <p>Access to the index is first in the query and used to find a number of
 items of interest; further information is obtained about these items from
 the RDF data.</p>
@@ -259,7 +260,7 @@ the RDF data.</p>
 
 <p>Limit is useful here when working with large indexes to limit results to the
 more higher scoring results.</p>
-<h4 id="query-pattern-2-wzxhzdk18-filter">Query pattern 2 &ndash; Filter</h4>
+<h4 id="query-pattern-2-wzxhzdk20-filter">Query pattern 2 &ndash; Filter</h4>
 <p>By finding items of interest first in the RDF data, the text search can be
 used to restrict the items found still further.</p>
 <div class="codehilite"><pre><span class="n">SELECT</span> ?<span
class="n">s</span>
@@ -371,6 +372,38 @@ purely in-memory setup:</p>
 </pre></div>
 
 
+<h3 id="graph-specific-indexing">Graph-specific Indexing</h3>
+<p>Starting with version 1.0.1-SNAPSHOT from 2013-12-10, jena-text supports
+storing information about the source graph into the text index. This allows
+for more efficient text queries when the query targets only a single named
+graph. Without graph-specific indexing, text queries do not distinguish named
+graphs and will always return results from all graphs.</p>
+<p>Support for graph-specific indexing is enabled by defining the name of the
+index field to use for storing the graph identifier.</p>
+<p>If you use an assembler configuration, set the graph field using the
+text:graphField property on the EntityMap, e.g.</p>
+<div class="codehilite"><pre><span class="c"># Mapping in the index</span>
+<span class="c"># URI stored in field &quot;uri&quot;</span>
+<span class="c"># Graph stored in field &quot;graph&quot;</span>
+<span class="c"># rdfs:label is mapped to field &quot;text&quot;</span>
+<span class="o">&lt;</span><span class="c">#entMap&gt; a text:EntityMap
;</span>
+    <span class="nb">text</span><span class="p">:</span><span
class="n">entityField</span>      <span class="s">&quot;uri&quot;</span>
<span class="p">;</span>
+    <span class="nb">text</span><span class="p">:</span><span
class="n">graphField</span>       <span class="s">&quot;graph&quot;</span>
<span class="p">;</span>
+    <span class="nb">text</span><span class="p">:</span><span
class="n">defaultField</span>     <span class="s">&quot;text&quot;</span>
<span class="p">;</span>
+    <span class="nb">text</span><span class="p">:</span><span
class="n">map</span> <span class="p">(</span>
+         <span class="p">[</span> <span class="nb">text</span><span
class="p">:</span><span class="n">field</span> <span class="s">&quot;text&quot;</span>
<span class="p">;</span> <span class="nb">text</span><span class="p">:</span><span
class="n">predicate</span> <span class="n">rdfs</span><span class="p">:</span><span
class="n">label</span> <span class="p">]</span>
+         <span class="p">)</span> <span class="p">.</span>
+</pre></div>
+
+
+<p>If you configure the index in Java code, you need to use one of the
+EntityDefinition constructors that support the graphField parameter, e.g.</p>
+<div class="codehilite"><pre>    <span class="n">EntityDefinition</span>
<span class="n">entDef</span> <span class="p">=</span> <span class="n">new</span>
<span class="n">EntityDefinition</span><span class="p">(</span>&quot;<span
class="n">uri</span>&quot;<span class="p">,</span> &quot;<span
class="n">text</span>&quot;<span class="p">,</span> &quot;<span
class="n">graph</span>&quot;<span class="p">,</span> <span class="n">RDFS</span><span
class="p">.</span><span class="n">label</span><span class="p">.</span><span
class="n">asNode</span><span class="p">())</span> <span class="p">;</span>
+</pre></div>
+
+
+<p><strong>Note:</strong> If you migrate from a global (non-graph-aware)
index to a graph-aware index,
+you need to rebuild the index to ensure that the graph information is stored.</p>
 <h2 id="working-with-fuseki">Working with Fuseki</h2>
 <p>The Fuseki configuration simply points to the text dataset as the
 <code>fuseki:dataset</code> of the service.</p>



Mime
View raw message