Skip to content

Commit

Permalink
rfe10993: add bidirectional-search-paths to example21
Browse files Browse the repository at this point in the history
<release-note>
rfe10993: add bidirectional-search-paths to example21

Added code to tutorial example21 demonstrating use of
SNA method bidirectional-search-paths.
</release-note>

make prepush passes.
ant tutorial runs clean.

Change-Id: I24047e6fd0e6eb05c1ff316a9f953828c7d9fab9
Reviewed-on: https://gerrit.franz.com:9080/1742
Reviewed-by: John O'Rourke <jor@franz.com>
Reviewed-by: Ahmon Dancy <dancy@franz.com>
Tested-by: Kevin Layer <layer@franz.com>
  • Loading branch information
Bill Millar authored and dklayer committed Oct 31, 2011
1 parent 25a2ef6 commit 81dbb0f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/tutorial/TutorialExamples.java
Original file line number Diff line number Diff line change
Expand Up @@ -2166,6 +2166,22 @@ public static void example21() throws Exception {
println("Number of results: " + count);
result.close();

println("\nBidirectional paths connecting Valjean to Bossuet using associates (should be two).");
queryString = "(select (?pathid ?node)" +
"(bidirectional-search-paths !lm:character11 !lm:character64 associates ?path)" +
// make a ?pathid for ?path here, must be an RDF value
"(lisp ?pathid (new-blank-node))" +
"(member ?node ?path))";
tupleQuery = conn.prepareTupleQuery(AGQueryLanguage.PROLOG, queryString);
result = tupleQuery.evaluate();
while (result.hasNext()) {
BindingSet bindingSet = result.next();
Value p = bindingSet.getValue("pathid");
Value n = bindingSet.getValue("node");
println("Path " + p + ": " + n);
}
result.close();

println("\nNodal degree of Valjean (should be seven).");
queryString = "(select (?degree)" +
"(nodal-degree !lm:character11 associates ?degree))";
Expand Down

0 comments on commit 81dbb0f

Please sign in to comment.