本文整理汇总了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);
}