當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。