|
29 | 29 | * Developer's Guide</a>. |
30 | 30 | */ |
31 | 31 | public interface SPARQLQueryDefinition extends QueryDefinition { |
| 32 | + /** Set the SPARQL query or update statement |
| 33 | + * |
| 34 | + * @param sparql the SPARQL statement |
| 35 | + */ |
32 | 36 | public void setSparql(String sparql); |
| 37 | + |
| 38 | + /** Set the SPARQL query or update statement |
| 39 | + * |
| 40 | + * @param sparql the SPARQL statement |
| 41 | + */ |
33 | 42 | public void setSparql(TextWriteHandle sparql); |
| 43 | + |
| 44 | + /** Get the SPARQL query or update statement |
| 45 | + * |
| 46 | + * @return the SPARQL statement |
| 47 | + */ |
34 | 48 | 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 | + */ |
35 | 56 | 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 | + */ |
36 | 64 | public SPARQLQueryDefinition withSparql(TextWriteHandle sparql); |
37 | 65 |
|
| 66 | + /** Set the child SPARQLBindings instance. */ |
38 | 67 | public void setBindings(SPARQLBindings bindings); |
| 68 | + |
| 69 | + /** Get the child SPARQLBindings instance (normally populated by calls to |
| 70 | + * withBinding methods). */ |
39 | 71 | 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 | + */ |
40 | 80 | 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 | + */ |
41 | 90 | 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 | + */ |
42 | 103 | 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 | + */ |
43 | 109 | public SPARQLQueryDefinition clearBindings(); |
44 | 110 |
|
| 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 { <a> <b> <c> }"; |
| 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 | + */ |
45 | 125 | 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 | + */ |
46 | 130 | 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 | + */ |
47 | 140 | public SPARQLQueryDefinition withUpdatePermission(String role, Capability capability); |
48 | 141 |
|
49 | 142 | public String getBaseUri(); |
| 143 | + |
| 144 | + /** set the base IRI for the query |
| 145 | + * @param uri the base uri |
| 146 | + */ |
50 | 147 | public void setBaseUri(String uri); |
| 148 | + |
51 | 149 | 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 | + */ |
55 | 156 | 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 | + */ |
56 | 164 | 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 | + */ |
57 | 173 | 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 | + */ |
58 | 182 | public void setUsingNamedGraphUris(String... uris); |
59 | 183 |
|
| 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. */ |
60 | 187 | public void setConstrainingQueryDefinition(QueryDefinition query); |
61 | 188 | 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 | + */ |
62 | 197 | public SPARQLQueryDefinition withConstrainingQuery(QueryDefinition query); |
63 | 198 |
|
| 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 | + */ |
64 | 205 | public void setRulesets(SPARQLRuleset... ruleset); |
65 | 206 | 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 | + */ |
66 | 215 | public SPARQLQueryDefinition withRuleset(SPARQLRuleset ruleset); |
67 | 216 | public SPARQLQueryDefinition withStructuredQuery(QueryDefinition structuredQuery); |
68 | 217 |
|
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); |
70 | 224 | 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); |
72 | 232 |
|
73 | 233 | 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 | + */ |
74 | 238 | public void setOptimzeLevel(int level); |
75 | 239 | } |
0 commit comments