Browse files

bug19389 - Java tutorial bad links

Pursuing bug19389 I found that my java tutorial files
for 4.0.4 and 4.0.5 had begun to diverge.  This is the
third attempt at a recombined file containing all of
the recent changes to example12() and fixing the broken links.

No release notes. The
html file looked ok in the browser.

Change-Id: I78dffabcb6b3dbda0684f9a2ed5a55b15323ef6b
  • Loading branch information...
1 parent 280d190 commit f285cd4efe01b23c90876989a7cf12fbbfc53f89 @BruceDClayton BruceDClayton committed Jun 9, 2010
Showing with 5 additions and 9 deletions.
  1. +5 −9 src/tutorial/java-tutorial-40.html
View
14 src/tutorial/java-tutorial-40.html
@@ -1040,13 +1040,8 @@ <h2 id="Namespaces">Namespaces (example11()) &nbsp;&nbsp;&nbsp;<a class="returnl
</pre>
<h2 id="Free Text Search">Free Text Search (example12()) &nbsp;&nbsp;&nbsp;<a class="returnlink" href="#Contents">Return to Top</a></h2>
-<p>
-It is common for users to build RDF applications that combine
-some form of "keyword search" with their queries. For example, a user
-might want to retrieve all triples for which the string "Alice" appears
-as a word within the third (object) argument to the triple. AllegroGraph
-provides a capability for including free text matching within a SPARQL
-query. It requires, however, that you register the predicates that will participate in text searches so they can be indexed. </p>
+<p> It is common for users to build RDF applications that combine
+some form of "keyword search" with their queries. For example, a user might want to retrieve all triples for which the string "Alice" appears as a word within the third (object) argument to the triple. AllegroGraph provides a capability for including free text matching within a SPARQL query. It requires, however, that you create and configure indexes appropriate to the searches you want to pursue. </p>
<p> The example example12() begins by borrowing the connection object from example1(). Then it creates a namespace string and registers the namespace with the connection object, as in the previous example. </p>
<pre class="input"> public static void example12 () throws Exception { <br> AGRepositoryConnection conn = example1(false);<br> ValueFactory f = conn.getValueFactory();<br> String exns = &quot;http://example.org/people/&quot;;<br> conn.setNamespace(&quot;ex&quot;, exns);</pre>
<p>We have to register the predicates that will participate in text indexing. In the example12() example below, we have
@@ -1062,8 +1057,9 @@ <h2 id="Free Text Search">Free Text Search (example12()) &nbsp;&nbsp;&nbsp;<a cl
<p>Add the new book, <em>Alice in Wonderland</em>. </p>
<pre class="input"> conn.add(book, RDF.TYPE, booktype); <br> conn.add(book, booktitle, wonderland); </pre>
<p>Now we set up the SPARQL query that looks for triples containing &quot;Alice&quot; in the object position. </p>
-<p>The text match occurs through a &quot;magic&quot; predicate called <strong>fti:match</strong>. This is not an RDF &quot;predicate&quot; but a LISP &quot;predicate,&quot; meaning that it behaves as a true/false test. This predicate has two arguments. One is the subject URI of the resources to search. The other is the string pattern to search for, such as &quot;Alice&quot;. Only registered text predicates will be searched. Only full-word matches will be found. </p>
-<pre class="input"> String queryString = <br> &quot;SELECT ?s ?p ?o &quot; +<br> &quot;WHERE { ?s ?p ?o . ?s fti:match 'Alice' . }&quot;;</pre>
+<p>The text match occurs through a &quot;magic&quot; predicate called <strong>fti:match</strong>. This is not an RDF &quot;predicate&quot; but a LISP &quot;predicate,&quot; meaning that it behaves as a true/false test. This predicate has two arguments. One is the subject URI of the resources to search. The other is the string pattern to search for, such as &quot;Alice&quot;. Only registered text predicates will be searched. Only full-word matches will be found. </p>
+<pre class="input"> String queryString = <br> &quot;SELECT ?s ?p ?o &quot; +<br> &quot;WHERE { ?s ?p ?o .
+ ?s fti:match 'Alice' . }&quot;;</pre>
<p>There is no need to include a prefix declaration for the 'fti' nickname. That is because 'fti' is included among the built-in namespace/nickname mappings in AllegroGraph.</p>
<p>When we execute our SPARQL query, it matches the "Alice" within the literal "Alice B. Toklas" because that literal occurs in a triple having the registered <strong>fullname</strong> predicate, but it does not match the "Alice" in the literal "Alice in Wonderland" because the <strong>booktitle</strong> predicate was not registered for text indexing. This query returns <em>all triples</em> of a resource that had a successful match in at least one object value. </p>
<pre class="input"> TupleQuery tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString);<br> TupleQueryResult result = (TupleQueryResult)tupleQuery.evaluate();<br> int count = 0;<br> while (result.hasNext()) {<br> BindingSet bindingSet = result.next();<br> if (count &lt; 5) {<br> println(bindingSet);<br> }<br> count += 1;<br> }</pre>

0 comments on commit f285cd4

Please sign in to comment.