|
21 | 21 |
|
22 | 22 | /** <p>Represents binding names and values to be sent with a SPARQL Query. |
23 | 23 | * 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 | + * "<http://example.org/s1> <http://example.org/p1> <http://example.org/object1> .\n" + |
| 31 | + * "<http://example.org/s2> <http://example.org/p2> \"object2\" .\n" + |
| 32 | + * "<http://example.org/s3> <http://example.org/p3> \"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> |
26 | 53 | * |
27 | 54 | * <p>For more about RDF literals, see <a |
28 | 55 | * href="http://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal" |
|
33 | 60 | * Developer's Guide</a>. |
34 | 61 | */ |
35 | 62 | 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 | + * |
37 | 65 | * @param name the bound variable name |
38 | | - * @param value the value of type iri |
| 66 | + * @param value the iri value |
39 | 67 | * |
40 | 68 | * @return this instance (for method chaining) |
41 | 69 | */ |
42 | 70 | 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 | + * |
44 | 74 | * @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 |
47 | 77 | * |
48 | 78 | * @return this instance (for method chaining) |
49 | 79 | */ |
50 | 80 | public SPARQLBindings bind(String name, String value, RDFTypes datatype); |
51 | | - /** Bind a variable of type |
| 81 | + |
| 82 | + /** <p>Bind a variable of type |
52 | 83 | * 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 | + */ |
57 | 93 | public SPARQLBindings bind(String name, String value, Locale languageTag); |
58 | 94 | }; |
0 commit comments