本文整理匯總了Java中org.openrdf.query.QueryLanguage.SPARQL屬性的典型用法代碼示例。如果您正苦於以下問題:Java QueryLanguage.SPARQL屬性的具體用法?Java QueryLanguage.SPARQL怎麽用?Java QueryLanguage.SPARQL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.openrdf.query.QueryLanguage
的用法示例。
在下文中一共展示了QueryLanguage.SPARQL屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getQuery
public RdfQueryDefinition getQuery(SPARQLParameters params) {
RdfQueryDefinition query = new RdfQueryDefinition(QueryLanguage.SPARQL, params.getQuery());
RDFWriterConfig config = new RDFWriterConfig();
config.setBaseUri(platformConfig.getString("platform.baseUri"));
config.setContentTypeConfig(new SPARQLWriterTypeConfig());
config.setJSONPCallback(params.getJSONPCallback());
if (params.isPlainText()) {
// config.setResponseContentType(WriterContentTypeConfig.MIME_TEXT_PLAIN);
} else {
// config.setResponseContentType(WriterContentTypeConfig.MIME_SPARQL_RESULTS_JSON);
}
query.setWriterConfig(config);
return query;
}
示例2: toOpenRDFQueryLanguage
public static QueryLanguage toOpenRDFQueryLanguage(String queryLanguage) {
String queryLanguageLowerCase = queryLanguage.toLowerCase();
if(queryLanguageLowerCase.equals("sparql")) {
return QueryLanguage.SPARQL;
} else if(queryLanguageLowerCase.equals("serql")) {
return QueryLanguage.SERQL;
} else if(queryLanguageLowerCase.equals("serqo")) {
return QueryLanguage.SERQO;
} else {
throw new QueryLanguageNotSupportedException("Query language '"
+ queryLanguageLowerCase
+ "' not supported. Valid values are \"sparql\", \"serql\" and \"serqo\".");
}
}
示例3: getLanguage
@Override
public QueryLanguage getLanguage() {
return QueryLanguage.SPARQL;
}
示例4: generate
public RdfQueryDefinition generate(RestParameters params)
throws MalformedQueryException {
LinkedList<String> uriPathParts = params.getURIPathParts();
RestRelation relation = rootRelation.findRelation(uriPathParts);
if (relation == null) {
throw new MalformedQueryException();
}
RelationType type = relation.getType();
RelationQuantity quantity = relation.getQuantity();
boolean ordered = params.isOrdered();
boolean calculateCount = /*(params.getPage() == 1) &&*/ params.isCountTotals() && (quantity == RelationQuantity.MULTIPLE);
SPARQLQuery query = null;
Map<String, String> bindings = new HashMap<String, String>();
if (type == RelationType.SELF) {
if (quantity == RelationQuantity.SINGLE) {
query = querySingleSelf;
bindings.put("object", relation.getObjectURI(uriPathParts, uriPathParts.size() - 1));
bindings.put("class", relation.getClassURI());
} else if (relation.getQuantity() == RelationQuantity.MULTIPLE) {
query = queryMultipleSelf;
bindings.put("class", relation.getClassURI());
}
} else {
if (relation.getParent() != null) {
String objectURI = relation.getParent().getObjectURI(uriPathParts, uriPathParts.size() - 2);
String classURI = relation.getParent().getClassURI();
String linkedClassURI = relation.getClassURI();
if (type == RelationType.FORWARD) {
query = queryMultipleForward;
/*
if (quantity == RelationQuantity.SINGLE) {
} else if (quantity == RelationQuantity.MULTIPLE) {
}*/
} else if (type == RelationType.BACKWARD) {
query = queryMultipleBackward;
} else if (type == RelationType.BACKWARDFORWARD) {
query = queryMultipleBackwardForward;
}
bindings.put("this", objectURI);
bindings.put("class", classURI);
bindings.put("linkedClass", linkedClassURI);
}
}
if (query == null) {
throw new MalformedQueryException();
}
String construct = query.generateContruct(relation, params, bindings, true, ordered);
String count = calculateCount ? query.generateCount(relation, params, bindings, true) : null;
logger.info(construct);
return new RdfQueryDefinition(
QueryLanguage.SPARQL, construct, count, quantity == RelationQuantity.SINGLE);
}
示例5: RepositoryQueryResultTable
public RepositoryQueryResultTable(String queryString, RepositoryConnection connection)
throws ModelRuntimeException {
this(queryString, QueryLanguage.SPARQL, connection);
}
示例6: prepareTupleQuery
/**
* Prepares a query that produces sets of value tuples.
*
* @param ql
* The query language in which the query is formulated.
* @param query
* The query string.
* @param baseURI
* The base URI to resolve any relative URIs that are in the query
* against, can be <tt>null</tt> if the query does not contain any
* relative URIs.
* @throws IllegalArgumentException
* If the supplied query is not a tuple query.
* @throws MalformedQueryException
* If the supplied query is malformed.
* @throws UnsupportedQueryLanguageException
* If the supplied query language is not supported.
*/
@Override
public TupleQuery prepareTupleQuery(QueryLanguage ql, String query, String baseURI)
// throws StoreException, MalformedQueryException {
throws RepositoryException, MalformedQueryException {
if (ql != QueryLanguage.SPARQL)
throw new UnsupportedQueryLanguageException("only SPARQL supported");
if (query == null)
throw new IllegalArgumentException("query is null");
if (baseURI != null)
throw new IllegalArgumentException("base/relative URIs not allowed");
return QueryExecutor.prepareTupleQuery(query, this.endpoint, null);
}