Package thewebsemantic
Class Sparql
- java.lang.Object
-
- thewebsemantic.Sparql
-
public class Sparql extends Object
-
-
Constructor Summary
Constructors Constructor Description Sparql()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> LinkedList<T>exec(org.apache.jena.rdf.model.Model m, Class<T> c, String query)Helpful for binding a query result set with a single solution subject to a particular java bean.static <T> LinkedList<T>exec(org.apache.jena.rdf.model.Model m, Class<T> c, String query, org.apache.jena.query.QuerySolution initialBindings)static <T> LinkedList<T>exec(RDF2Bean reader, Class<T> c, String query, org.apache.jena.query.QuerySolution initialBindings, int start, int max)static <T> LinkedList<org.apache.jena.rdf.model.Resource>exec2(org.apache.jena.rdf.model.Model m, String query, org.apache.jena.query.QuerySolution initialBindings)static voidupdate(org.apache.jena.rdf.model.Model m, String query, org.apache.jena.query.QuerySolution i)
-
-
-
Method Detail
-
exec
public static <T> LinkedList<T> exec(org.apache.jena.rdf.model.Model m, Class<T> c, String query)
Helpful for binding a query result set with a single solution subject to a particular java bean. This returns a collection of beans. Queries are required to follow this pattern in the select clause:SELECT ?s WHERE ...Jenabean will attempt to create an instance of typecbound to the RDF resources returned in your query. It's important to use name variable ?s. This is the named variable Jenabean will expect. You should make sure that your query only returns one type or base type, for example, this snippet ensures that only resources of OWL type Bird are selected...SELECT ?s WHERE { ?s a :Bird ...If you SPARQL query returns heterogenous types, classcast exceptions will be thrown.- Type Parameters:
T-- Parameters:
m- jena modelc- Java Class to which the OWL type is bound toquery- a full SPARQL query- Returns:
-
exec
public static <T> LinkedList<T> exec(org.apache.jena.rdf.model.Model m, Class<T> c, String query, org.apache.jena.query.QuerySolution initialBindings)
-
exec
public static <T> LinkedList<T> exec(RDF2Bean reader, Class<T> c, String query, org.apache.jena.query.QuerySolution initialBindings, int start, int max)
-
exec2
public static <T> LinkedList<org.apache.jena.rdf.model.Resource> exec2(org.apache.jena.rdf.model.Model m, String query, org.apache.jena.query.QuerySolution initialBindings)
-
update
public static void update(org.apache.jena.rdf.model.Model m, String query, org.apache.jena.query.QuerySolution i)
-
-