Class QueryUtils
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils
-
public class QueryUtils extends Object
Utilities for executing queries and working with query results.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringbindVariables(String queryStr, org.apache.jena.query.QuerySolution initialBindings)The RDFService interface doesn't support initial bindings, so do text substitutions instead.static org.apache.jena.query.ResultSetgetLanguageNeutralQueryResults(String queryStr, VitroRequest vreq)static org.apache.jena.query.ResultSetgetQueryResults(String queryStr, VitroRequest vreq)static org.apache.jena.query.ResultSetgetQueryResults(String queryStr, org.apache.jena.query.QuerySolution initialBindings, RDFService rdfService)static ObjectnodeToObject(org.apache.jena.rdf.model.RDFNode node)static StringnodeToString(org.apache.jena.rdf.model.RDFNode node)static Map<String,Object>querySolutionToObjectValueMap(org.apache.jena.query.QuerySolution soln)static Map<String,String>querySolutionToStringValueMap(org.apache.jena.query.QuerySolution soln)static List<Map<String,String>>removeDuplicatesMapsFromList(List<Map<String,String>> rawList, String... keys)If any pair of maps in the list has the same (non-null) value for any of these keys, call the maps duplicates and keep only the first of them.static StringreplaceQueryVar(String queryString, String varName, String newVarName)Replace one variable name with anotherstatic StringsubUriForQueryVar(String queryString, String varName, String uri)Manually replace a query variable with a uri when prebinding causes the query to fail, probably due to a Jena bug.static StringsubUrisForQueryVars(String queryString, Map<String,String> varsToUris)Manually replace query variables with uris when prebinding causes the query to fail, probably due to a Jena bug.
-
-
-
Method Detail
-
querySolutionToObjectValueMap
public static Map<String,Object> querySolutionToObjectValueMap(org.apache.jena.query.QuerySolution soln)
-
querySolutionToStringValueMap
public static Map<String,String> querySolutionToStringValueMap(org.apache.jena.query.QuerySolution soln)
-
removeDuplicatesMapsFromList
public static List<Map<String,String>> removeDuplicatesMapsFromList(List<Map<String,String>> rawList, String... keys)
If any pair of maps in the list has the same (non-null) value for any of these keys, call the maps duplicates and keep only the first of them.
-
nodeToObject
public static Object nodeToObject(org.apache.jena.rdf.model.RDFNode node)
-
nodeToString
public static String nodeToString(org.apache.jena.rdf.model.RDFNode node)
-
subUrisForQueryVars
public static String subUrisForQueryVars(String queryString, Map<String,String> varsToUris)
Manually replace query variables with uris when prebinding causes the query to fail, probably due to a Jena bug.
-
subUriForQueryVar
public static String subUriForQueryVar(String queryString, String varName, String uri)
Manually replace a query variable with a uri when prebinding causes the query to fail, probably due to a Jena bug.
-
replaceQueryVar
public static String replaceQueryVar(String queryString, String varName, String newVarName)
Replace one variable name with another
-
getQueryResults
public static org.apache.jena.query.ResultSet getQueryResults(String queryStr, VitroRequest vreq)
-
getQueryResults
public static org.apache.jena.query.ResultSet getQueryResults(String queryStr, org.apache.jena.query.QuerySolution initialBindings, RDFService rdfService)
-
getLanguageNeutralQueryResults
public static org.apache.jena.query.ResultSet getLanguageNeutralQueryResults(String queryStr, VitroRequest vreq)
-
-