Skip to content

Commit 48d551d

Browse files
committed
more javadocs
(cherry picked from commit 53bab01)
1 parent 3b1c099 commit 48d551d

File tree

10 files changed

+206
-26
lines changed

10 files changed

+206
-26
lines changed

src/main/java/com/marklogic/client/io/marker/QuadsWriteHandle.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
package com.marklogic.client.io.marker;
1717

1818
/**
19-
* A marker interface for handles capable of writing semantic quads.
20-
* For details about semantics in MarkLogic see
21-
* {@link https://docs.marklogic.com/guide/semantics Semantics Developer's Guide}
19+
* <p>A marker interface for handles capable of writing semantic quads.</p>
20+
*
21+
* <p>For details about RDF, SPARQL, and semantics in MarkLogic see
22+
* <a href="https://docs.marklogic.com/guide/semantics" target="_top">Semantics Developer's Guide</a>
2223
*/
2324
public interface QuadsWriteHandle extends AbstractWriteHandle {
2425
}

src/main/java/com/marklogic/client/io/marker/TriplesReadHandle.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
package com.marklogic.client.io.marker;
1717

1818
/**
19-
* A marker interface for handles capable of reading semantic triples.
20-
* For details about semantics in MarkLogic see
21-
* {@link https://docs.marklogic.com/guide/semantics Semantics Developer's Guide}
19+
* <p>A marker interface for handles capable of reading semantic triples.</p>
20+
*
21+
* <p>For details about RDF, SPARQL, and semantics in MarkLogic see
22+
* <a href="https://docs.marklogic.com/guide/semantics" target="_top">Semantics Developer's Guide</a>
2223
*/
2324
public interface TriplesReadHandle extends AbstractReadHandle {
2425
}

src/main/java/com/marklogic/client/io/marker/TriplesWriteHandle.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
package com.marklogic.client.io.marker;
1717

1818
/**
19-
* A marker interface for handles capable of writing semantic triples.
20-
* For details about semantics in MarkLogic see
21-
* {@link https://docs.marklogic.com/guide/semantics Semantics Developer's Guide}
19+
* <p>A marker interface for handles capable of writing semantic triples.</p>
20+
*
21+
* <p>For details about RDF, SPARQL, and semantics in MarkLogic see
22+
* <a href="https://docs.marklogic.com/guide/semantics" target="_top">Semantics Developer's Guide</a>
2223
*/
2324
public interface TriplesWriteHandle extends AbstractWriteHandle {
2425
}

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616
package com.marklogic.client.semantics;
1717

1818
/**
19-
* The capabilities available for operations on graphs.
20-
* For details about semantics in MarkLogic see
21-
* {@link https://docs.marklogic.com/guide/semantics Semantics Developer's Guide}
19+
* <p>The permission capabilities available for operations on graphs. Used in
20+
* {@link GraphManager#permission}, {@link SPARQLQueryManager#permission}, and
21+
* {@link GraphPermissions#permission}. See usage examples in javadocs for
22+
* {@link GraphManager} and {@link SPARQLQueryManager}.</p>
23+
*
24+
* <p>For details about RDF, SPARQL, and semantics in MarkLogic see
25+
* <a href="https://docs.marklogic.com/guide/semantics" target="_top">Semantics Developer's Guide</a>
2226
*/
2327
public enum Capability { READ, UPDATE, EXECUTE; }

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,20 @@
2121
import com.marklogic.client.semantics.Capability;
2222

2323
/**
24-
* A Map of permissions for a graph, where the keys are roles and the values
25-
* are the Set of capabilities available to that role (one of READ, UPDATE, or EXECUTE).
26-
* For details about semantics in MarkLogic see
27-
* {@link https://docs.marklogic.com/guide/semantics Semantics Developer's Guide}
24+
* <p>A Map of permissions for a graph, where the keys are roles and the values
25+
* are the Set of capabilities available to that role (one of READ, UPDATE, or
26+
* EXECUTE). See usage examples in javadocs for {@link GraphManager} and
27+
* {@link SPARQLQueryManager}.</p>
28+
*
29+
* <p>For details about RDF, SPARQL, and semantics in MarkLogic see
30+
* <a href="https://docs.marklogic.com/guide/semantics" target="_top">Semantics Developer's Guide</a>
2831
*/
2932
public interface GraphPermissions extends Map<String, Set<Capability>> {
30-
/** Add the specified role and capabilities.
33+
/** Add the specified role and capabilities to this GraphPermissions object.
34+
*
3135
* @param role the name of the role receiving these capabilities
32-
* @param capabilities the capabilities (read, update, or execute) granted to this role
36+
* @param capabilities the capabilities (READ, UPDATE, or EXECUTE) granted to this role
37+
*
3338
* @return the new GraphPermissions object with these permissions added
3439
*/
3540
public GraphPermissions permission(String role, Capability... capabilities);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
*/
1616
package com.marklogic.client.semantics;
1717

18-
/** The types supported for binding variables against SPARQL queries. */
18+
/** <p>The XSD/<a href="http://www.w3.org/TR/rdf11-concepts/#xsd-datatypes">RDF
19+
* literal types</a> supported for binding variables against SPARQL
20+
* queries.</p>
21+
*/
1922
public enum RDFTypes {
2023
STRING ("string"),
2124
BOOLEAN ("boolean"),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* bindings.bind("o", "http://example.org/object1");
3737
* JacksonHandle results = sparqlMgr.executeSelect(qdef, new JacksonHandle());</pre>
3838
*
39-
* <p>Example matching a string with a language tag (re-using data and variables above):</p>
39+
* <p>Example matching a literal of rdf data type string (re-using data and variables above):</p>
4040
*
4141
* <pre> qdef = sparqlMgr.newQueryDefinition(select);
4242
* bindings = qdef.getBindings();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Some static constants to ease use of mime types appropriate for handles of
77
* type {@link SPARQLResultsReadHandle} (used in
88
* {@link SPARQLQueryManager#executeSelect SPARQLQueryManager.executeSelect}).
9+
* For more explanation, see {@link SPARQLQueryManager}.
910
*/
1011
public final class SPARQLMimeTypes {
1112

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

Lines changed: 169 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,47 +29,211 @@
2929
* Developer's Guide</a>.
3030
*/
3131
public interface SPARQLQueryDefinition extends QueryDefinition {
32+
/** Set the SPARQL query or update statement
33+
*
34+
* @param sparql the SPARQL statement
35+
*/
3236
public void setSparql(String sparql);
37+
38+
/** Set the SPARQL query or update statement
39+
*
40+
* @param sparql the SPARQL statement
41+
*/
3342
public void setSparql(TextWriteHandle sparql);
43+
44+
/** Get the SPARQL query or update statement
45+
*
46+
* @return the SPARQL statement
47+
*/
3448
public String getSparql();
49+
50+
/** Set the SPARQL query or update statement
51+
*
52+
* @param sparql the SPARQL statement
53+
*
54+
* @return this instance (for method chaining)
55+
*/
3556
public SPARQLQueryDefinition withSparql(String sparql);
57+
58+
/** Set the SPARQL query or update statement
59+
*
60+
* @param sparql the SPARQL statement
61+
*
62+
* @return this instance (for method chaining)
63+
*/
3664
public SPARQLQueryDefinition withSparql(TextWriteHandle sparql);
3765

66+
/** Set the child SPARQLBindings instance. */
3867
public void setBindings(SPARQLBindings bindings);
68+
69+
/** Get the child SPARQLBindings instance (normally populated by calls to
70+
* withBinding methods). */
3971
public SPARQLBindings getBindings();
72+
73+
/** <p>Bind a variable of type iri.</p>
74+
*
75+
* @param name the bound variable name
76+
* @param value the iri value
77+
*
78+
* @return this instance (for method chaining)
79+
*/
4080
public SPARQLQueryDefinition withBinding(String name, String value);
81+
82+
/** <p>Bind a variable of specified type.</p>
83+
*
84+
* @param name the bound variable name
85+
* @param value the value of the literal
86+
* @param type the literal type
87+
*
88+
* @return this instance (for method chaining)
89+
*/
4190
public SPARQLQueryDefinition withBinding(String name, String value, RDFTypes type);
91+
92+
/** <p>Bind a variable of type
93+
* http://www.w3.org/1999/02/22-rdf-syntax-ns#langString with the specified
94+
* language tag. Note that we call {@link Locale#toLanguageTag}
95+
* to get compliant IETF BCP 47 language tags.</p>
96+
*
97+
* @param name the bound variable name
98+
* @param value the value as a string
99+
* @param languageTag the language and regional modifiers compliant with BCP-47
100+
*
101+
* @return this instance (for method chaining)
102+
*/
42103
public SPARQLQueryDefinition withBinding(String name, String value, Locale languageTag);
104+
105+
/** <p>Remove all variable bindings from the child SPARQLBindings instance.</p>
106+
*
107+
* @return this instance (for method chaining)
108+
*/
43109
public SPARQLQueryDefinition clearBindings();
44110

111+
/** <p>For use with {@link SPARQLQueryManager#executeUpdate SPARQL update},
112+
* where specified permissions will apply to any records created by the
113+
* update. Create a GraphPermissions builder object with the specified
114+
* role and capabilities.</p>
115+
*
116+
* <p>For example:</p>
117+
*
118+
* <pre> String sparqlUpdate = "INSERT DATA { &lt;a&gt; &lt;b&gt; &lt;c&gt; }";
119+
* SPARQLQueryDefinition qdef = sparqlMgr.newQueryDefinition(sparqlUpdate);
120+
* qdef.setUpdatePermissions(sparqlMgr.permission("rest-reader", Capability.UPDATE));
121+
* sparqlMgr.executeUpdate(qdef);</pre>
122+
*
123+
* @param permissions the permissions (use {@link SPARQLQueryManager#permission} to create)
124+
*/
45125
public void setUpdatePermissions(GraphPermissions permissions);
126+
127+
/** Get any permissions set on this instance. This does not get any info
128+
* from the database.
129+
*/
46130
public GraphPermissions getUpdatePermissions();
131+
132+
/** Calls {@link #setUpdatePermissions} then returns this instance for
133+
* method chaining.
134+
*
135+
* @param role the name of the role receiving these capabilities
136+
* @param capability the capabilities (READ, UPDATE, or EXECUTE) granted to this role
137+
*
138+
* @return this instance (for method chaining)
139+
*/
47140
public SPARQLQueryDefinition withUpdatePermission(String role, Capability capability);
48141

49142
public String getBaseUri();
143+
144+
/** set the base IRI for the query
145+
* @param uri the base uri
146+
*/
50147
public void setBaseUri(String uri);
148+
51149
public String[] getDefaultGraphUris();
52-
public String[] getNamedGraphUris();
53-
public String[] getUsingGraphUris();
54-
public String[] getUsingNamedGraphUris();
150+
/** Set the URI of the graph or graphs to use as the default graph. Use
151+
* with SPARQL query only. If this parameter is used with SPARQL Update, it
152+
* will cause an exception.
153+
*
154+
* @param uris the default graph uris
155+
*/
55156
public void setDefaultGraphUris(String... uris);
157+
158+
public String[] getNamedGraphUris();
159+
/** Set the URI of a named graph or graphs to include in the query or
160+
* update operation. Use with SPARQL query only. If this parameter is used
161+
* with SPARQL Update, it will cause an exception.
162+
* @param uris the named graph uris
163+
*/
56164
public void setNamedGraphUris(String... uris);
165+
166+
public String[] getUsingGraphUris();
167+
/** Set the URI of the graph or graphs to address as part of a SPARQL
168+
* update operation. Use with SPARQL Update only. If this parameter is used
169+
* with SPARQL query, it will cause an exception.
170+
*
171+
* @param uris the graph uris
172+
*/
57173
public void setUsingGraphUris(String... uris);
174+
175+
public String[] getUsingNamedGraphUris();
176+
/** Set the URI of a named graph or graphs to address as part of a SPARQL
177+
* update operation. Use with SPARQL Update only. If this parameter is used
178+
* with SPARQL query, it will cause an exception.
179+
*
180+
* @param uris the named graph uris
181+
*/
58182
public void setUsingNamedGraphUris(String... uris);
59183

184+
/** Set the search query used to constrain the set of documents included in
185+
* the SPARQL query. Only meant to query unmanaged triples. The behavior
186+
* is unspecified if used to query managed triples. */
60187
public void setConstrainingQueryDefinition(QueryDefinition query);
61188
public QueryDefinition getConstrainingQueryDefinition();
189+
/** Set the search query used to constrain the set of documents included in
190+
* the SPARQL query. Only meant to query unmanaged triples. The behavior
191+
* is unspecified if used to query managed triples.
192+
*
193+
* @param query the query to use to constrain
194+
*
195+
* @return this instance (for method chaining)
196+
*/
62197
public SPARQLQueryDefinition withConstrainingQuery(QueryDefinition query);
63198

199+
/** Set the name of rulesets to include for inferring triples. Ruleset
200+
* names can be those of the built-in rulesets, or user-managed rulesets
201+
* stored in the schemas database.
202+
*
203+
* @param ruleset the names of the rulesets to use
204+
*/
64205
public void setRulesets(SPARQLRuleset... ruleset);
65206
public SPARQLRuleset[] getRulesets();
207+
/** Set the name of rulesets to include for inferring triples. Ruleset
208+
* names can be those of the built-in rulesets, or user-managed rulesets
209+
* stored in the schemas database.
210+
*
211+
* @param ruleset the name of the ruleset to use
212+
*
213+
* @return this instance (for method chaining)
214+
*/
66215
public SPARQLQueryDefinition withRuleset(SPARQLRuleset ruleset);
67216
public SPARQLQueryDefinition withStructuredQuery(QueryDefinition structuredQuery);
68217

69-
public void setIncludeDefaultRulesets(Boolean b);
218+
/** Set whether to include database-default inference or not. Default is true.
219+
*
220+
* @param include whether to include or not
221+
*
222+
*/
223+
public void setIncludeDefaultRulesets(Boolean include);
70224
public Boolean getIncludeDefaultRulesets();
71-
public SPARQLQueryDefinition withIncludeDefaultRulesets(Boolean b);
225+
/** Set whether to include database-default inference or not. Default is true.
226+
*
227+
* @param include whether to include or not
228+
*
229+
* @return this instance (for method chaining)
230+
*/
231+
public SPARQLQueryDefinition withIncludeDefaultRulesets(Boolean include);
72232

73233
public int getOptimizeLevel();
234+
/** Set a number indicating how much time for the query engine to spend
235+
* analyzing a query. (See <a href="http://docs.marklogic.com/sem:sparql">sem:sparql</a>
236+
* in the server-side XQuery API docs)
237+
*/
74238
public void setOptimzeLevel(int level);
75239
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public interface SPARQLQueryManager {
206206
* sparqlMgr.executeUpdate(qdef);</pre>
207207
*
208208
* @param role the name of the role receiving these capabilities
209-
* @param capabilities the capabilities (read, update, or execute) granted to this role
209+
* @param capabilities the capabilities (READ, UPDATE, or EXECUTE) granted to this role
210210
* @return the new GraphPermissions object with these capabilities set
211211
*/
212212
public GraphPermissions permission(String role, Capability... capabilities);

0 commit comments

Comments
 (0)