Skip to content

Commit 047a288

Browse files
committed
more javadocs
(cherry picked from commit a0f71c49c91a9f3cc5c3fb3ad61303769d53d45d)
1 parent 1c40847 commit 047a288

File tree

3 files changed

+55
-17
lines changed

3 files changed

+55
-17
lines changed

src/main/java/com/marklogic/client/semantics/GraphManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*
3737
* <p>For example:</p>
3838
*
39-
* <p>If you have a file called "example.ttl" containing one triple in turtle
39+
* <p>If you have a file called "example.nt" containing one triple in turtle
4040
* mimetype:</p>
4141
*
4242
* <pre> &lt;http://example.org/subject1&gt; &lt;http://example.org/predicate1&gt; &lt;http://example.org/object1&gt; .</pre>
@@ -45,7 +45,7 @@
4545
* like so:</p>
4646
*
4747
* <pre> GraphManager graphMgr = databaseClient.newGraphManager();
48-
* FileHandle fileHandle = new FileHandle(new File("example.ttl")).withMimetype(RDFMimeTypes.NTRIPLES);
48+
* FileHandle fileHandle = new FileHandle(new File("example.nt")).withMimetype(RDFMimeTypes.NTRIPLES);
4949
* graphMgr.write("myExample/graphUri", fileHandle);
5050
* </pre>
5151
*

src/main/java/com/marklogic/client/semantics/SPARQLBinding.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
import java.util.Locale;
1919

2020
/**
21-
* Represents a binding name, value, and type or language tag.
22-
* For details about semantics in MarkLogic see
23-
* {@link https://docs.marklogic.com/guide/semantics Semantics Developer's Guide}
21+
* <p>Represents a binding name, value, and type or language tag.</p>
22+
*
23+
* <p>For details about RDF, SPARQL, and semantics in MarkLogic see the <a
24+
* href="https://docs.marklogic.com/guide/semantics" target="_top">Semantics
25+
* Developer's Guide</a>.
2426
*/
2527
public interface SPARQLBinding {
2628
public String getName();

src/main/java/com/marklogic/client/semantics/SPARQLBindings.java

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,35 @@
2121

2222
/** <p>Represents binding names and values to be sent with a SPARQL Query.
2323
* Available for situations where {@link SPARQLQueryDefinition#withBinding
24-
* SPARQLQueryDefinition.withBinding} methods are not enough. For example
25-
* usage, see {@link SPARQLQueryManager}.</p>
24+
* SPARQLQueryDefinition.withBinding} methods are not enough.
25+
*
26+
* <p>Example matching an iri:</p>
27+
*
28+
* <pre> graphMgr.setDefaultMimetype(RDFMimeTypes.NTRIPLES);
29+
* graphMgr.writeAs("http://example.org",
30+
* "&lt;http://example.org/s1&gt; &lt;http://example.org/p1&gt; &lt;http://example.org/object1&gt; .\n" +
31+
* "&lt;http://example.org/s2&gt; &lt;http://example.org/p2&gt; \"object2\" .\n" +
32+
* "&lt;http://example.org/s3&gt; &lt;http://example.org/p3&gt; \"object3\"@en .");
33+
* String select = "SELECT * WHERE { ?s ?p ?o }";
34+
* SPARQLQueryDefinition qdef = sparqlMgr.newQueryDefinition(select);
35+
* SPARQLBindings bindings = qdef.getBindings();
36+
* bindings.bind("o", "http://example.org/object1");
37+
* JacksonHandle results = sparqlMgr.executeSelect(qdef, new JacksonHandle());</pre>
38+
*
39+
* <p>Example matching a string with a language tag (re-using data and variables above):</p>
40+
*
41+
* <pre> qdef = sparqlMgr.newQueryDefinition(select);
42+
* bindings = qdef.getBindings();
43+
* bindings.bind("o", "object2", RDFTypes.STRING);
44+
* results = sparqlMgr.executeSelect(qdef, new JacksonHandle());</pre>
45+
*
46+
*
47+
* <p>Example matching a string with a language tag (re-using data and variables above):</p>
48+
*
49+
* <pre> qdef = sparqlMgr.newQueryDefinition(select);
50+
* bindings = qdef.getBindings();
51+
* bindings.bind("o", "object3", new Locale("en"));
52+
* results = sparqlMgr.executeSelect(qdef, new JacksonHandle());</pre>
2653
*
2754
* <p>For more about RDF literals, see <a
2855
* href="http://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal"
@@ -33,26 +60,35 @@
3360
* Developer's Guide</a>.
3461
*/
3562
public interface SPARQLBindings extends Map<String, List<SPARQLBinding>> {
36-
/** Bind a variable of type iri.
63+
/** <p>Bind a variable of type iri.</p>
64+
*
3765
* @param name the bound variable name
38-
* @param value the value of type iri
66+
* @param value the iri value
3967
*
4068
* @return this instance (for method chaining)
4169
*/
4270
public SPARQLBindings bind(String name, String value);
43-
/** Bind a variable of specified type.
71+
72+
/** <p>Bind a variable of specified type.</p>
73+
*
4474
* @param name the bound variable name
45-
* @param value the value of type iri
46-
* @param datatype the type
75+
* @param value the value of the literal
76+
* @param datatype the literal type
4777
*
4878
* @return this instance (for method chaining)
4979
*/
5080
public SPARQLBindings bind(String name, String value, RDFTypes datatype);
51-
/** Bind a variable of type
81+
82+
/** <p>Bind a variable of type
5283
* http://www.w3.org/1999/02/22-rdf-syntax-ns#langString with the specified
53-
* language tag. Note that we call <a
54-
* href="http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#toLanguageTag%28%29"
55-
* >Locale.toLanguageTag()</a>
56-
* to get compliant IETF BCP 47 language tags. */
84+
* language tag. Note that we call {@link Locale#toLanguageTag}
85+
* to get compliant IETF BCP 47 language tags.</p>
86+
*
87+
* @param name the bound variable name
88+
* @param value the value as a string
89+
* @param languageTag the language and regional modifiers compliant with BCP-47
90+
*
91+
* @return this instance (for method chaining)
92+
*/
5793
public SPARQLBindings bind(String name, String value, Locale languageTag);
5894
};

0 commit comments

Comments
 (0)