Class Sparql


  • public class Sparql
    extends Object
    • Constructor Detail

      • Sparql

        public Sparql()
    • 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 type c bound 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 model
        c - Java Class to which the OWL type is bound to
        query - 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)