Permalink
Browse files

bug19358 - Java tutorial bad internal link

java-tutorial-40.html had one of those pesky "dedicated session"
link issues. One link fixed.

No need for release notes. I have tested the page in
Firefox and the link works.

Change-Id: I175fccdcd1f209e9d7fd6744a48af64d54c4affb
  • Loading branch information...
1 parent 711b6db commit 280d1906fb198176004cd4d45cb5c66d9dcfe209 @BruceDClayton BruceDClayton committed with dklayer Jun 8, 2010
Showing with 16 additions and 19 deletions.
  1. +16 −19 src/tutorial/java-tutorial-40.html
@@ -168,7 +168,7 @@ <h2 id="Creating Users with WebView">Creating Users with WebView &nbsp;&nbsp;&nb
<p>In addition, a user account may be given read, write or read/write access to individual repositories. </p>
<p>You can also define a <strong>role</strong> (such as &quot;librarian&quot;) and give the role a set of permissions and access rules. Then you can assign several users to a shared role. This lets you manage their permissions and access by editing the role instead of the individual user accounts. </p>
<p>A <strong>superuser</strong> automatically has all possible permissions and unlimited access. A superuser can also create, manage and delete other user accounts. Non-superusers cannot view or edit account settings. </p>
- <p>A user with the <strong>Start Sessions</strong> permission can use the AllegroGraph features that require spawning a dedicated session, such as <a href="#Dedicated Session">Transactions </a> and <a href="#Social Network Analysis">Social Network Analysis</a>. If you try to use these features without the appropriate permission, you'll encounter authentication errors. </p>
+ <p>A user with the <strong>Start Sessions</strong> permission can use the AllegroGraph features that require spawning a dedicated session, such as <a href="#Transaction">Transactions </a> and <a href="#Social Network Analysis">Social Network Analysis</a>. If you try to use these features without the appropriate permission, you'll encounter authentication errors. </p>
<p>A user with permission to <strong>Evaluate Arbitrary Code </strong>can run <a href="#Prolog Rule Queries">Prolog Rule Queries</a>.
@@ -880,7 +880,7 @@ <h2 id="Literal Values">Literal Values (example5())&nbsp;&nbsp;&nbsp;<a class="r
</tr>
</table>
<p>Note that we searched for &quot;1984-12-06T09:00:00+01:00&quot; but found &quot;1984-12-06T08:00:00Z&quot;. It is the same moment in time. </p>
-<h2 id="Importing Triples">Importing Triples (example6() and example7()) &nbsp;&nbsp;&nbsp;<a class="returnlink" href="#Contents">Return to Top</a></h2>
+<h2>Importing Triples (example6() and example7()) &nbsp;&nbsp;&nbsp;<a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>
The Java API client can load triples in either RDF/XML format or NTriples format. The example below calls the connection object's <strong>add()</strong> method to load
an NTriples file, and <strong>addFile()</strong> to load an RDF/XML file. Both methods work, but the best practice is to use addFile(). </p>
@@ -1042,31 +1042,28 @@ <h2 id="Namespaces">Namespaces (example11()) &nbsp;&nbsp;&nbsp;<a class="returnl
<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 create and configure indexes appropriate to the searches you want to pursue. </p>
+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> 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 create an index. AllegroGraph lets you create any number of text indexes, each for a specific purpose. In this case we are indexing the literal values we find in the &quot;fullname&quot; predicate, which we will use in resources that describe people. The createFreeTextIndex() method has many configurable parameters. Their default settings are appropriate to this situation. All we have to provide is a name for the index and the URI of the predicate (or predicates) that contain the text to be indexed. </p>
-<pre class="input"> conn.createFreetextIndex(&quot;index1&quot;, new URI[]{f.createURI(exns,&quot;fullname&quot;)});</pre>
-<p>The next step is to create three new resources. One is a person, &quot;Alice,&quot; whose full name is &quot;Alice B. Toklas.&quot; There will also be a book, &quot;Alice in Wonderland,&quot; which is linked to an author resource, &quot;Lewis Carroll.&quot; The first step is to create some URIs and literal values from which to assemble the triples: </p>
-<pre class="input"> // Create parts of person resources. <br> URI alice = f.createURI(exns, &quot;alice1&quot;);<br> URI carroll = f.createURI(exns, &quot;carroll&quot;);<br> URI persontype = f.createURI(exns, &quot;Person&quot;);<br> URI fullname = f.createURI(exns, &quot;fullname&quot;); <br> Literal alicename = f.createLiteral(&quot;Alice B. Toklas&quot;);<br> Literal lewisCarroll = f.createLiteral(&quot;Lewis Carroll&quot;);<br> // Create parts of book resources.<br> URI book = f.createURI(exns, &quot;book1&quot;);<br> URI booktype = f.createURI(exns, &quot;Book&quot;);<br> URI booktitle = f.createURI(exns, &quot;title&quot;);<br> URI author = f.createURI(exns, &quot;author&quot;);<br> Literal wonderland = f.createLiteral(&quot;Alice in Wonderland&quot;);</pre>
+<p>We have to register the predicates that will participate in text indexing. In the example12() example below, we have
+called the connection method <strong>registerFreeTextPredicate()</strong> to register the predicate "http://example.org/people/fullname" for text indexing. Generating the predicate's URI is a separate step. </p>
+<pre class="input"> conn.registerFreetextPredicate(f.createURI(exns,&quot;fullname&quot;));</pre>
+<p>The next step is to create two new resources, &quot;Alice1&quot; named &quot;Alice B. Toklas,&quot; and &quot;book1&quot; with the title &quot;Alice in Wonderland.&quot; Notice that we did not register the book title predicate for text indexing. </p>
+<pre class="input"> URI alice = f.createURI(exns, &quot;alice1&quot;);<br> URI persontype = f.createURI(exns, &quot;Person&quot;);<br> URI fullname = f.createURI(exns, &quot;fullname&quot;); <br> Literal alicename = f.createLiteral(&quot;Alice B. Toklas&quot;);<br> URI book = f.createURI(exns, &quot;book1&quot;);<br> URI booktype = f.createURI(exns, &quot;Book&quot;);<br> URI booktitle = f.createURI(exns, &quot;title&quot;); <br> Literal wonderland = f.createLiteral(&quot;Alice in Wonderland&quot;);</pre>
<p>Clear the repository, so our new triples are the only ones available. </p>
<pre class="input">
conn.clear() </pre>
<p>Add the resource for the new person, Alice B. Toklas: </p>
<pre class="input"> conn.add(alice, RDF.TYPE, persontype);<br> conn.add(alice, fullname, alicename);</pre>
<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);
- conn.add(book, author, carroll);</pre>
-<p>Note that the book's author predicate links to the resource URI of the Lewis Carroll author resource. The author is a Person with a fullname:</p>
-<pre class="input"> conn.add(carroll, RDF.TYPE, persontype);<br> conn.add(carroll, fullname, lewisCarroll);</pre>
-<p>Let's use getStatements() to retrieve the new triples and inspect them:</p>
-<pre class="output">(http://example.org/people/alice1, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://example.org/people/Person) [null]<br>(http://example.org/people/alice1, http://example.org/people/fullname, &quot;Alice B. Toklas&quot;) [null]
-<br>(http://example.org/people/book1, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://example.org/people/Book) [null]<br>(http://example.org/people/book1, http://example.org/people/title, &quot;Alice in Wonderland&quot;) [null]<br>(http://example.org/people/book1, http://example.org/people/author, http://example.org/people/carroll) [null]
-<br>(http://example.org/people/carroll, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://example.org/people/Person) [null]<br>(http://example.org/people/carroll, http://example.org/people/fullname, &quot;Lewis Carroll&quot;) [null]</pre>
+<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>
+<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>
@@ -1643,7 +1640,7 @@ <h3 id="Group Centrality">Group Centrality</h3>
<h2 id="Transaction">Transaction (example22())</h2>
<p>Triples are normally loaded one at a time in &quot;auto-commit&quot; mode. Each triple enters the triple store individually. It is possible that a batch of incoming triples, all describing the same resource, might be interrupted for some reason. An interrupted load can leave the triple store in an unknown state. </p>
<p>In some applications we can't run the risk of having a resource that is incomplete. To guard against this hazard, AllegroGraph can turn off auto-commit behavior and use &quot;transaction&quot; behavior instead. With auto-commit turned off, we can add triples until we have a complete set, a known state. If anything goes wrong to interrupt the load, we can roll the transaction back and start over. Otherwise, commit the transaction and all the triples enter the store at once. </p>
-<p>In order to use transaction semantics, the user account must have &quot;:session&quot; privileges with AllegroGraph Server. This is an elevated level of privilege. AllegroGraph users are profiled through the </p>
+<p>In order to use transaction semantics, the user account must have &quot;start sessions&quot; privileges with AllegroGraph Server. This is an elevated level of privilege. AllegroGraph users are profiled through the <a href="#Creating Users with WebView">WebView interface.</a></p>
<p>In practice, transaction semantics require at least two connections to the triple store, one in auto-commit mode and one in transaction mode. Queries should be run against the auto-commit connection, where the resources are always in a known and complete state. The transaction connection is used for loading and commiting batches of triples. </p>
<p>&quot;Commit&quot; means to make a batch of newly-loaded triples visible in the auto-commit connection. The two sessions are &quot;synched up&quot; by the commit. Any &quot;new&quot; triples added to either connection will suddenly be visible in both connections after a commit. </p>
<p>&quot;Rollback&quot; means to discard the recent additions to the transaction connection. This, too, synchs up the two sessions. After a rollback, the transaction connection &quot;sees&quot; exactly the same triples as the auto-commit connection does. </p>
@@ -1801,6 +1798,6 @@ <h2 id="Duplicate Triples">Duplicate Triples (example23()) &nbsp;&nbsp;&nbsp;<a
<p>Federation changes the semantics of &quot;duplicate triples.&quot; Be sure to take this into account in your project design. </p>
-<p><font color="#CCCCCC">March 23, 2010 4.0.2 release</font></p>
+<p><font color="#CCCCCC">June 8, 2010 4.0.4 release</font></p>
</body>
</html>

0 comments on commit 280d190

Please sign in to comment.