當前位置: 首頁>>代碼示例>>Java>>正文


Java Resource.toString方法代碼示例

本文整理匯總了Java中org.apache.jena.rdf.model.Resource.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java Resource.toString方法的具體用法?Java Resource.toString怎麽用?Java Resource.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.jena.rdf.model.Resource的用法示例。


在下文中一共展示了Resource.toString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Label

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
protected Label(Resource resource, String value, Language language) throws ModelException {
	try {
		this.resource = resource;
		this.uri = new URI(resource.getURI());
		this.value = value;
		this.language = language;
	} catch (URISyntaxException e) {
		throw new ModelException("Unable to generate URI from resource: '%s'", resource.toString());
	}
}
 
開發者ID:Smartlogic-Semaphore-Limited,項目名稱:Java-APIs,代碼行數:11,代碼來源:Label.java

示例2: getStreamDescriptionFromRDF

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
/**
 * Method used to get the description(fields) of a particular sensor via Virtuoso
 * 
 * @param streamID the UUID of the stream
 * @return an arrayList containing the names of all the fields of that particular sensor with UUID = streamID
 */
private ArrayList<String> getStreamDescriptionFromRDF(String streamID) {

	fieldsFromRDF = new ArrayList<String>();
	//System.out.println("streamID : "+streamID);
	
	// creating a query to send to Virtuoso sparql endpoint		
	String query_SPARQL = "PREFIX DUL: <http://www.loa-cnr.it/ontologies/DUL.owl#> "
			+ "PREFIX ces: <http://www.insight-centre.org/ces#> " 
			+ "PREFIX ct: <http://ict-citypulse.eu/city#> "
			+ "PREFIX daml: <http://www.daml.org/2001/03/daml+oil#> "
			+ "PREFIX dc: <http://purl.org/dc/elements/1.1/> " 
			+ "PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
			+ "PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> "
			+ "PREFIX muo: <http://purl.oclc.org/NET/muo/muo#> " 
			+ "PREFIX owl: <http://www.w3.org/2002/07/owl#> "
			+ "PREFIX owls: <http://www.daml.org/services/owl-s/1.2/Service.owl#> "
			+ "PREFIX owlsg: <http://www.daml.org/services/owl-s/1.2/Grounding.owl#> "
			+ "PREFIX owlss: <http://www.daml.org/services/owl-s/1.2/Service.owl#> "
			+ "PREFIX owlssc: <http://www.daml.org/services/owl-s/1.2/ServiceCategory.owl#> "
			+ "PREFIX owlssp: <http://www.daml.org/services/owl-s/1.2/Profile.owl#> "
			+ "PREFIX owlssrp: <http://www.daml.org/services/owl-s/1.2/ServiceParameter.owl#> "
			+ "PREFIX prov: <http://www.w3.org/ns/prov#> " 
			+ "PREFIX qoi: <http://purl.oclc.org/NET/UASO/qoi#> "
			+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
			+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
			+ "PREFIX sao: <http://purl.oclc.org/NET/UNIS/sao/sao#> "
			+ "PREFIX skos: <http://www.w3.org/2004/02/skos/core#> "
			+ "PREFIX ssn: <http://purl.oclc.org/NET/ssnx/ssn#> " 
			+ "PREFIX time: <http://www.w3.org/2006/time#> "
			+ "PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#> "
			+ "PREFIX tzont: <http://www.w3.org/2006/timezone#> "
			+ "PREFIX vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> "
			+ "PREFIX wot: <http://xmlns.com/wot/0.1/> " 
			+ "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> "
			+ "PREFIX xml: <http://www.w3.org/XML/1998/namespace> "
			+ "PREFIX ns1: <http://www.daml.org/services/owl-s/1.2/ServiceCategory.owl#> " 
			+ "select ?x "
			+ " where {" 
			+ "<http://ict-citypulse.eu/PrimitiveEventService-" + streamID+ "> owls:supports ?grounding.  " 
			+ "?grounding ces:hasExchangeName ?exchange. "
			+ "?grounding ces:hasTopic ?topic.   " 
			+ "<http://ict-citypulse.eu/PrimitiveEventService-" + streamID+ ">  ces:hasPhysicalEventSource ?sensor. " 
			+ "?sensor ssn:observes ?x. " 
			+ "?x rdf:type ?pType. "
			+ "Filter (str(?exchange)=\"annotated_data\")" 
			+ "}";

	// sparql request
	String SPARQL_endpoint = Commons.SPARQL_ENDPOINT;

	QueryExecution x = QueryExecutionFactory.sparqlService(SPARQL_endpoint, query_SPARQL);
	ResultSet results = x.execSelect();
	
	while (results.hasNext()) {
		QuerySolution thisRow = results.next();
		Resource myResource = thisRow.getResource("x");
		String myString = myResource.toString();
		
		myString = myString.substring(myString.lastIndexOf("#") + 1, myString.length());
		fieldsFromRDF.add(myString);
	}
	
	if(fieldsFromRDF.isEmpty())
	{
		valid = false;
	}
	
	return fieldsFromRDF;

}
 
開發者ID:CityPulse,項目名稱:Event-Detector,代碼行數:77,代碼來源:StreamDetails.java


注:本文中的org.apache.jena.rdf.model.Resource.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。