当前位置: 首页>>代码示例>>Java>>正文


Java QueryLanguage.SPARQL属性代码示例

本文整理汇总了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;
	}
 
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:16,代码来源:SPARQLService.java

示例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\".");
	}
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:15,代码来源:ConversionUtil.java

示例3: getLanguage

@Override
public QueryLanguage getLanguage() {
    return QueryLanguage.SPARQL;
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:4,代码来源:SPARQLRenderer.java

示例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);
}
 
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:69,代码来源:RestRelationQueryGenerator.java

示例5: RepositoryQueryResultTable

public RepositoryQueryResultTable(String queryString, RepositoryConnection connection)
        throws ModelRuntimeException {
	this(queryString, QueryLanguage.SPARQL, connection);
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:4,代码来源:RepositoryQueryResultTable.java

示例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);
	}
 
开发者ID:goerlitz,项目名称:rdffederator,代码行数:32,代码来源:VoidRepositoryConnection.java


注:本文中的org.openrdf.query.QueryLanguage.SPARQL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。