• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ParameterizedSparqlString类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.jena.query.ParameterizedSparqlString的典型用法代码示例。如果您正苦于以下问题:Java ParameterizedSparqlString类的具体用法?Java ParameterizedSparqlString怎么用?Java ParameterizedSparqlString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParameterizedSparqlString类属于org.apache.jena.query包,在下文中一共展示了ParameterizedSparqlString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getLabel

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
/**
 * Return the label for this object in the selected language
 * @param language - the language for which the label is requested
 * @return - the label in the requested language.
 * @throws ModelException - thrown if there are multiple labels present for this object in this language
 */
public Label getLabel(Language language) throws ModelException {
	String sparql = "SELECT ?label WHERE { ?objectURI rdfs:label ?label . FILTER(LANG(?label) = STR(?labelLanguage)) }";
	ParameterizedSparqlString parameterizedSparql = new ParameterizedSparqlString(model);
	parameterizedSparql.setCommandText(sparql);
	parameterizedSparql.setParam("objectURI", resource);
	parameterizedSparql.setParam("labelLanguage", model.createLiteral(language.getCode(), ""));
	
	Query query = QueryFactory.create(parameterizedSparql.asQuery());

	QueryExecution qexec = QueryExecutionFactory.create(query, model);
	ResultSet resultSet = qexec.execSelect();
	
	if (!resultSet.hasNext()) return null;
	
	QuerySolution querySolution = resultSet.next();
	Label label = new Label(querySolution.getLiteral("label"));
	
	if (!resultSet.hasNext()) return label;
	
	throw new ModelException("%s has more than one label in language '%s'", resource.getURI(), language.getCode());
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:28,代码来源:ObjectWithURI.java


示例2: getParameterizedSparqlString

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
public ParameterizedSparqlString getParameterizedSparqlString(org.spinrdf.model.TemplateCall spinTemplateCall, URI base)
   {
if (spinTemplateCall == null) throw new IllegalArgumentException("TemplateCall cannot be null");
if (base == null) throw new IllegalArgumentException("Base URI cannot be null");

       if (spinTemplateCall.getTemplate() == null)
       {
           if (log.isErrorEnabled()) log.error("SPIN Template of TemplateCall '{}' not found", spinTemplateCall);
           throw new OntologyException("SPIN Template of TemplateCall '" + spinTemplateCall + "' not found");
       }
       if (spinTemplateCall.getTemplate().getBody() == null)
       {
           if (log.isErrorEnabled()) log.error("Body Command of SPIN Template '{}' not found (spin:body missing)", spinTemplateCall.getTemplate());
           throw new OntologyException("Body Command of SPIN Template '" + spinTemplateCall.getTemplate() + "' not found (spin:body missing)");
       }

       return new ParameterizedSparqlString(spinTemplateCall.getTemplate().getBody().toString(), null, base.toString());
   }
 
开发者ID:AtomGraph,项目名称:Processor,代码行数:19,代码来源:TemplateImpl.java


示例3: getSenseLabel

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
@Override
public String getSenseLabel(QName ref) {
	ParameterizedSparqlString stmt = new ParameterizedSparqlString(
			"SELECT ?word WHERE {\n"
			+ "?sense wordnet-ontology:synset_member ?word\n"
			+ "}", model);
	stmt.setIri("sense", this.asRef(ref));
	final String sparql = stmt.toString();
	log.trace("getSenseLabel SPARQL: {}", sparql);
	Query verbTxQuery = QueryFactory.create(sparql);
	QueryExecution qexec = QueryExecutionFactory.create(verbTxQuery, wn31tdb);
	try {
		ResultSet rs = qexec.execSelect();
		for (; rs.hasNext(); ) {
			QuerySolution soln = rs.next();
			String wordLocalName = soln.get("word").asResource().getLocalName();
			return wordLocalName;
		}
		log.warn("No wordnet-ontology:synset_member for sense " + ref);
		return shortQName(ref);
	} finally {
		qexec.close();
	}
}
 
开发者ID:lumenrobot,项目名称:relex-id,代码行数:25,代码来源:RelEx.java


示例4: getSenseRdfsLabel

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
public String getSenseRdfsLabel(QName ref) {
	ParameterizedSparqlString stmt = new ParameterizedSparqlString(
			"SELECT ?label WHERE {\n"
			+ "?sense rdfs:label ?label\n"
			+ "}", model);
	stmt.setIri("sense", this.asRef(ref));
	final String sparql = stmt.toString();
	log.trace("getSenseLabel SPARQL: {}", sparql);
	Query verbTxQuery = QueryFactory.create(sparql);
	QueryExecution qexec = QueryExecutionFactory.create(verbTxQuery, wn31tdb);
	try {
		ResultSet rs = qexec.execSelect();
		for (; rs.hasNext(); ) {
			QuerySolution soln = rs.next();
			String translation = soln.get("label").asLiteral().getString();
			return translation;
		}
		log.warn("No rdfs:label for sense " + ref);
		return shortQName(ref);
	} finally {
		qexec.close();
	}
}
 
开发者ID:lumenrobot,项目名称:relex-id,代码行数:24,代码来源:RelEx.java


示例5: getNounSenses

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
/**
 * Mapping from {@code ind} translations to WordNet senses for noun part-of-speech.
 * The value is String to save memory, it is short QName, where nsPrefix needs
 * to be explictly supported, e.g. {@code wn31} for nvarps.
 * 
 * @param nounLiteral Verb literal, please preserve capitalization because case-normalization will be performed here.
 * @return
 * @todo These aren't sorted/prioritized in any way.
 * @todo Need Cached by EHCache or something (never expire but with invalidation), or function-based index.
 */
public List<QName> getNounSenses(final String nounLiteral) {
	List<QName> senses = new ArrayList<>();
	ParameterizedSparqlString sparql = new ParameterizedSparqlString(
			"SELECT ?sense\n"
			+ "WHERE {\n"
			+ "	?sense wordnet-ontology:translation ?nounLiteral ;"
			+ "		wordnet-ontology:part_of_speech wordnet-ontology:noun\n"
			+ "} LIMIT 100", model);
	sparql.setLiteral("nounLiteral", nounLiteral.toLowerCase(), "ind");
	log.trace("getNounSenses '{}' SPARQL: {}", nounLiteral, sparql);
	Query verbTxQuery = QueryFactory.create(sparql.toString());
	QueryExecution qexec = QueryExecutionFactory.create(verbTxQuery, wn31tdb);
	try {
		ResultSet rs = qexec.execSelect();
		for (; rs.hasNext(); ) {
			QuerySolution soln = rs.next();
			QName senseRes = toQName(soln.get("sense").asResource());
			senses.add(senseRes);
		}
	} finally {
		qexec.close();
	}
	return senses;
}
 
开发者ID:lumenrobot,项目名称:relex-id,代码行数:35,代码来源:RelEx.java


示例6: getAdjectiveSenses

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
/**
 * Mapping from {@code ind} translations to WordNet senses for adjective part-of-speech.
 * The value is String to save memory, it is short QName, where nsPrefix needs
 * to be explictly supported, e.g. {@code wn31} for nvarps.
 * 
 * @param adjectiveLiteral Verb literal, please preserve capitalization because case-normalization will be performed here.
 * @return
 * @todo These aren't sorted/prioritized in any way.
 * @todo Need Cached by EHCache or something (never expire but with invalidation), or function-based index.
 */
public List<QName> getAdjectiveSenses(final String adjectiveLiteral) {
	List<QName> senses = new ArrayList<>();
	ParameterizedSparqlString sparql = new ParameterizedSparqlString(
			"SELECT ?sense\n"
			+ "WHERE {\n"
			+ "	?sense wordnet-ontology:translation ?adjectiveLiteral ;"
			+ "		wordnet-ontology:part_of_speech wordnet-ontology:adjective\n"
			+ "} LIMIT 100", model);
	sparql.setLiteral("adjectiveLiteral", adjectiveLiteral.toLowerCase(), "ind");
	log.trace("getAdjectiveSenses '{}' SPARQL: {}", adjectiveLiteral, sparql);
	Query verbTxQuery = QueryFactory.create(sparql.toString());
	QueryExecution qexec = QueryExecutionFactory.create(verbTxQuery, wn31tdb);
	try {
		ResultSet rs = qexec.execSelect();
		for (; rs.hasNext(); ) {
			QuerySolution soln = rs.next();
			QName senseRes = toQName(soln.get("sense").asResource());
			senses.add(senseRes);
		}
	} finally {
		qexec.close();
	}
	return senses;
}
 
开发者ID:lumenrobot,项目名称:relex-id,代码行数:35,代码来源:RelEx.java


示例7: getAdjectiveSatelliteSenses

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
/**
 * Mapping from {@code ind} translations to WordNet senses for {@link PartOfSpeechType#ADJECTIVE_SATELLITE} part-of-speech.
 * The value is String to save memory, it is short QName, where nsPrefix needs
 * to be explictly supported, e.g. {@code wn31} for nvarps.
 * 
 * @param adjectiveSatelliteLiteral Verb literal, please preserve capitalization because case-normalization will be performed here.
 * @return
 * @todo These aren't sorted/prioritized in any way.
 * @todo Need Cached by EHCache or something (never expire but with invalidation), or function-based index.
 */
public List<QName> getAdjectiveSatelliteSenses(final String adjectiveSatelliteLiteral) {
	List<QName> senses = new ArrayList<>();
	ParameterizedSparqlString sparql = new ParameterizedSparqlString(
			"SELECT ?sense\n"
			+ "WHERE {\n"
			+ "	?sense wordnet-ontology:translation ?adjectiveSatelliteLiteral ;"
			+ "		wordnet-ontology:part_of_speech wordnet-ontology:adjective_satellite\n"
			+ "} LIMIT 100", model);
	sparql.setLiteral("adjectiveSatelliteLiteral", adjectiveSatelliteLiteral.toLowerCase(), "ind");
	log.trace("getAdjectiveSatelliteSenses '{}' SPARQL: {}", adjectiveSatelliteLiteral, sparql);
	Query verbTxQuery = QueryFactory.create(sparql.toString());
	QueryExecution qexec = QueryExecutionFactory.create(verbTxQuery, wn31tdb);
	try {
		ResultSet rs = qexec.execSelect();
		for (; rs.hasNext(); ) {
			QuerySolution soln = rs.next();
			QName senseRes = toQName(soln.get("sense").asResource());
			senses.add(senseRes);
		}
	} finally {
		qexec.close();
	}
	return senses;
}
 
开发者ID:lumenrobot,项目名称:relex-id,代码行数:35,代码来源:RelEx.java


示例8: convertToSelect

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
protected Query convertToSelect(ParameterizedSparqlString pss, Set<String> varNames) {
	Query queryCpy = pss.asQuery();
	queryCpy.getQueryPattern();

	StringBuilder queryStr = new StringBuilder("SELECT DISTINCT ");
	for(String varName : varNames) {
		queryStr.append("?").append(varName).append(" ");
	}
	queryStr.append(queryCpy.getQueryPattern());
	ParameterizedSparqlString pssSelect = new ParameterizedSparqlString();
	pssSelect.setCommandText(queryStr.toString());
	pssSelect.setNsPrefixes(pss.getNsPrefixMap());
	pssSelect.append(" LIMIT ");
	pssSelect.append(this.limit);
	return pssSelect.asQuery();
}
 
开发者ID:dice-group,项目名称:IGUANA,代码行数:17,代码来源:PatternQueryHandler.java


示例9: getConcept

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
public Concept getConcept(URI uri) {
	Resource conceptResource = resourceFromURI(model, uri);
	String sparql = "ASK WHERE { ?conceptURI a ?classURI . ?classURI rdfs:subClassOf* skos:Concept . }";
	ParameterizedSparqlString findConceptSparql = new ParameterizedSparqlString(model);
	findConceptSparql.setCommandText(sparql);
	findConceptSparql.setParam("conceptURI", conceptResource);
	
	Query query = QueryFactory.create(findConceptSparql.asQuery());

	QueryExecution qexec = QueryExecutionFactory.create(query, model);
	return qexec.execAsk() ? new Concept(model, conceptResource) : null;
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:13,代码来源:SemaphoreModel.java


示例10: getConceptScheme

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
public ConceptScheme getConceptScheme(URI uri) {
	
	Resource conceptSchemeResource = model.getResource(uri.toString());
	
	String sparql = "ASK WHERE { ?conceptSchemeURI a skos:ConceptScheme . }";
	ParameterizedSparqlString findConceptSchemeSparql = new ParameterizedSparqlString(model);
	findConceptSchemeSparql.setCommandText(sparql);
	findConceptSchemeSparql.setParam("conceptSchemeURI", conceptSchemeResource);
	
	Query query = QueryFactory.create(findConceptSchemeSparql.asQuery());

	QueryExecution qexec = QueryExecutionFactory.create(query, model);
	return qexec.execAsk() ? new ConceptScheme(model, conceptSchemeResource) : null;
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:15,代码来源:SemaphoreModel.java


示例11: getMetadataTypeIfExists

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
public MetadataType getMetadataTypeIfExists(URI uri) throws ModelException {
	String sparql = "SELECT ?metadataTypeURI WHERE { VALUES ?metadataTypeURI { ?suppliedURI } . ?metadataTypeURI a owl:DatatypeProperty .  ?metadataTypeURI rdfs:range ?range . }";
	ParameterizedSparqlString findConceptSchemeSparql = new ParameterizedSparqlString(model);
	findConceptSchemeSparql.setCommandText(sparql);
	findConceptSchemeSparql.setParam("suppliedURI", model.getResource(uri.toString()));
	
	Query query = QueryFactory.create(findConceptSchemeSparql.asQuery());

	QueryExecution qexec = QueryExecutionFactory.create(query, model);
	ResultSet resultSet = qexec.execSelect();

	MetadataType metadataType = null;
	while (resultSet.hasNext()) {
		QuerySolution querySolution = resultSet.next();
		Resource range = querySolution.getResource("?range");
		if (XSD.xstring.equals(range)) {
			metadataType = new StringMetadataType(model, querySolution.getResource("?metadataTypeURI"));
		} else if (XSD.date.equals(range)) {
			metadataType = new CalendarMetadataType(model, querySolution.getResource("?metadataTypeURI"));
		} else if (XSD.xboolean.equals(range)) {
			metadataType = new BooleanMetadataType(model, querySolution.getResource("?metadataTypeURI"));
		} else {
			throw new ModelException(String.format("Unable to determine range for metadata type with URI: '%s'", uri));
		}
	}
	return metadataType;
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:28,代码来源:SemaphoreModel.java


示例12: getRelationshipType

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
public RelationshipType getRelationshipType(URI uri) throws ModelException {
	String sparql = 
			  "select ?relationshipTypeUri ?relationshipBaseType ?inverseRelationshipType where {"
			+ "  ?relationshipTypeUri rdfs:subPropertyOf* ?relationshipBaseType ."
			+ "  VALUES ?relationshipTypeUri { ?suppliedURI }"
			+ "  VALUES ?relationshipBaseType { skos:related skos:broader skos:narrower skosxl:altLabel }"
			+ "  OPTIONAL { ?relationshipTypeUri owl:inverseOf ?inverseRelationshipType }"
			+"}";
	ParameterizedSparqlString findRelationshipTypeSparql = new ParameterizedSparqlString(model);
	findRelationshipTypeSparql.setCommandText(sparql);
	findRelationshipTypeSparql.setParam("suppliedURI", model.getResource(uri.toString()));
	
	Query query = QueryFactory.create(findRelationshipTypeSparql.asQuery());

	QueryExecution qexec = QueryExecutionFactory.create(query, model);
	ResultSet resultSet = qexec.execSelect();

	RelationshipType relationshipType = null;
	while (resultSet.hasNext()) {
		QuerySolution querySolution = resultSet.next();
		Resource relationshipTypeResource = querySolution.getResource("?relationshipTypeUri");
		Resource inverseRelationshipTypeResource = querySolution.getResource("?inverseRelationshipType");
		Resource relationshipBaseTypeResource = querySolution.getResource("?relationshipBaseType");
		if ("broader".equals(relationshipBaseTypeResource.getLocalName())) {
			relationshipType = new HasBroaderRelationshipType(model, relationshipTypeResource, inverseRelationshipTypeResource);
		} else if ("narrower".equals(relationshipBaseTypeResource.getLocalName())) {
			relationshipType = new HasNarrowerRelationshipType(model, relationshipTypeResource, inverseRelationshipTypeResource);
		} else if ("related".equals(relationshipBaseTypeResource.getLocalName())) {
			relationshipType = new AssocativeRelationshipType(model, relationshipTypeResource, inverseRelationshipTypeResource);
		} else if ("altLabel".equals(relationshipBaseTypeResource.getLocalName())) {
			relationshipType = new HasEquivalentRelationshipType(model, relationshipTypeResource);
		} else {
			throw new ModelException("Unrecognized base type: '%s' for relationship '%s'", relationshipBaseTypeResource.getLocalName(), uri.toString());
		}
	}
	return relationshipType;
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:38,代码来源:SemaphoreModel.java


示例13: deleteLabelForLanguagePostCheck

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
private void deleteLabelForLanguagePostCheck(Label label) {
	String sparql =  "DELETE { ?objectURI rdfs:label ?labelValue } WHERE { ?objectURI rdfs:label ?labelValue . FILTER(LANG(?labelValue) = STR(?labelLanguage)) }";
	ParameterizedSparqlString parameterizedSparql = new ParameterizedSparqlString(model);
	parameterizedSparql.setCommandText(sparql);
	parameterizedSparql.setParam("objectURI", resource);
	parameterizedSparql.setParam("labelLanguage", model.createLiteral(label.getLanguageCode(), ""));
	
	UpdateAction.execute(parameterizedSparql.asUpdate(), model);
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:10,代码来源:ObjectWithURI.java


示例14: deleteLabelPostCheck

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
private void deleteLabelPostCheck(Label label) {
	String sparql = "DELETE { ?objectURI rdfs:label ?labelValue } WHERE { ?objectURI rdfs:label ?labelValue . FILTER (?labelValue = ?suppliedLabel) }";
	ParameterizedSparqlString parameterizedSparql = new ParameterizedSparqlString(model);
	parameterizedSparql.setCommandText(sparql);
	parameterizedSparql.setParam("objectURI", resource);
	parameterizedSparql.setParam("suppliedLabel", model.createLiteral(label.getValue(), label.getLanguageCode()));
	
	UpdateAction.execute(parameterizedSparql.asUpdate(), model);
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:10,代码来源:ObjectWithURI.java


示例15: labelExistsInLanguage

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
private boolean labelExistsInLanguage(Label label) {
	String sparql = "ASK WHERE { ?objectURI rdfs:label ?label . FILTER(LANG(?label) = STR(?labelLanguage)) }";
	ParameterizedSparqlString parameterizedSparql = new ParameterizedSparqlString(model);
	parameterizedSparql.setCommandText(sparql);
	parameterizedSparql.setParam("objectURI", resource);
	parameterizedSparql.setParam("labelLanguage", model.createLiteral(label.getLanguageCode(), ""));
	
	Query query = QueryFactory.create(parameterizedSparql.asQuery());

	QueryExecution qexec = QueryExecutionFactory.create(query, model);
	return qexec.execAsk();
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:13,代码来源:ObjectWithURI.java


示例16: labelExists

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
private boolean labelExists(Label label) {
	String sparql = "ASK WHERE { ?objectURI rdfs:label ?label }";
	ParameterizedSparqlString parameterizedSparql = new ParameterizedSparqlString(model);
	parameterizedSparql.setCommandText(sparql);
	parameterizedSparql.setParam("objectURI", resource);
	parameterizedSparql.setParam("label", model.createLiteral(label.getValue(), label.getLanguageCode()));
	
	Query query = QueryFactory.create(parameterizedSparql.asQuery());

	QueryExecution qexec = QueryExecutionFactory.create(query, model);
	return qexec.execAsk();
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:13,代码来源:ObjectWithURI.java


示例17: deleteLabelForLanguagePostCheck

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
private void deleteLabelForLanguagePostCheck(Label label) {
	String sparql = "DELETE { ?conceptSchemeURI rdfs:label ?labelValue } WHERE { ?conceptSchemeURI rdfs:label ?labelValue . FILTER(STRLANG(?label) = STR(?labelLanguage)) }";
	ParameterizedSparqlString parameterizedSparql = new ParameterizedSparqlString(model);
	parameterizedSparql.setCommandText(sparql);
	parameterizedSparql.setParam("conceptSchemeURI", resource);
	parameterizedSparql.setParam("labelLanguage", model.createLiteral(label.getValue(), label.getLanguageCode()));
	
	UpdateRequest updateRequest = UpdateFactory.create(parameterizedSparql.getCommandText()); 
	UpdateAction.execute(updateRequest, model);
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:11,代码来源:Concept.java


示例18: deleteLabelPostCheck

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
private void deleteLabelPostCheck(Label label) {
	String sparql = "DELETE { ?conceptSchemeURI rdfs:label ?labelValue } WHERE { }";
	ParameterizedSparqlString parameterizedSparql = new ParameterizedSparqlString(model);
	parameterizedSparql.setCommandText(sparql);
	parameterizedSparql.setParam("conceptSchemeURI", resource);
	parameterizedSparql.setParam("labelLanguage", model.createLiteral(label.getValue(), label.getLanguageCode()));
	
	UpdateRequest updateRequest = UpdateFactory.create(parameterizedSparql.getCommandText()); 
	UpdateAction.execute(updateRequest, model);
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:11,代码来源:Concept.java


示例19: labelExistsInLanguage

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
private boolean labelExistsInLanguage(Label label) {
	String sparql = "ASK WHERE { ?conceptSchemeURI rdfs:label ?label . FILTER(LANG(?label) = STR(?labelLanguage)) }";
	ParameterizedSparqlString parameterizedSparql = new ParameterizedSparqlString(model);
	parameterizedSparql.setCommandText(sparql);
	parameterizedSparql.setParam("conceptSchemeURI", resource);
	parameterizedSparql.setParam("labelLanguage", model.createLiteral(label.getLanguageCode(), ""));
	
	Query query = QueryFactory.create(parameterizedSparql.asQuery());

	QueryExecution qexec = QueryExecutionFactory.create(query, model);
	return qexec.execAsk();
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:13,代码来源:Concept.java


示例20: labelExists

import org.apache.jena.query.ParameterizedSparqlString; //导入依赖的package包/类
private boolean labelExists(Label label) {
	String sparql = "ASK * WHERE { ?conceptSchemeURI rdfs:label ?label }";
	ParameterizedSparqlString parameterizedSparql = new ParameterizedSparqlString(model);
	parameterizedSparql.setCommandText(sparql);
	parameterizedSparql.setParam("conceptSchemeURI", resource);
	parameterizedSparql.setParam("selectedLabel", model.createLiteral(label.getValue(), label.getLanguageCode()));
	
	Query query = QueryFactory.create(parameterizedSparql.asQuery());

	QueryExecution qexec = QueryExecutionFactory.create(query, model);
	return qexec.execAsk();
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:13,代码来源:Concept.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PacketReceivedEvent类代码示例发布时间:2022-05-23
下一篇:
Java SimpleJavaParameters类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap