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


Java Resource類代碼示例

本文整理匯總了Java中com.hp.hpl.jena.rdf.model.Resource的典型用法代碼示例。如果您正苦於以下問題:Java Resource類的具體用法?Java Resource怎麽用?Java Resource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getAgentUri

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
public Resource getAgentUri(VirtGraph graphOrgs, String vatId) {
	
	Resource agentUri = null;
	
	String queryUri = "PREFIX gr: <http://purl.org/goodrelations/v1#> " +
				"SELECT ?org ?vatId " +
				"FROM <" + QueryConfiguration.queryGraphOrganizations + "> " +
				"WHERE { " +
				"?org gr:vatID ?vatId . " +
				"FILTER ( ?vatId = \"" + vatId + "\"^^<http://www.w3.org/2001/XMLSchema#string> ) " +
				"}";

	VirtuosoQueryExecution vqeUri = VirtuosoQueryExecutionFactory.create(queryUri, graphOrgs);		
	ResultSet resultsUri = vqeUri.execSelect();
	
	if (resultsUri.hasNext()) {
		QuerySolution result = resultsUri.nextSolution();
		agentUri = result.getResource("org");
	}
	
	vqeUri.close();
	
	return agentUri;
}
 
開發者ID:YourDataStories,項目名稱:harvesters,代碼行數:25,代碼來源:Queries.java

示例2: validateComponentType

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
private void validateComponentType(Property property, Resource resource, 
		ComponentType... types) {
	if (resource == null) return;
	List<Resource> foundTypes = new ArrayList<Resource>(types.length);
	List<Resource> supportedTypes = new ArrayList<Resource>(types.length);
	for (ComponentType type: types) {
		supportedTypes.add(type.asResource());
		MappingComponent value = mapping.getMappingComponent(resource, type);
		if (value != null) {
			foundTypes.add(type.asResource());
		}
	}
	if (foundTypes.isEmpty()) {
		report.report(Problem.VALUE_NOT_OF_EXPECTED_TYPE, getContextResource(), property, 
				supportedTypes.toArray(new Resource[supportedTypes.size()]));
	} else if (foundTypes.size() > 1) {
		report.report(Problem.CONFLICTING_TYPES, getContextResource(), property, 
				foundTypes.toArray(new Resource[foundTypes.size()]));
	}
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:21,代碼來源:MappingValidator.java

示例3: generateEntities

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
public void generateEntities(Resource class_, TableName table,
		TemplateValueMaker iriTemplate, List<Identifier> blankNodeColumns) {
	log.info("Generating d2rq:ClassMap instance for table " + Microsyntax.toString(table));
	ClassMap result = getClassMap(table);
	result.setComment("Table " + Microsyntax.toString(table));
	if (iriTemplate == null) {
		result.setBNodeIdColumns(table.qualifyIdentifiers(blankNodeColumns));
	} else {
		if (iriTemplate.columns().length == 0) {
			result.setComment(result.getComment() + 
					"\nNOTE: Sorry, I don't know which columns to put into the d2rq:uriPattern\n" +
					"because the table doesn't have a primary key. Please specify it manually.");
		}
		result.setURIPattern(Microsyntax.toString(iriTemplate));
	}
	if (class_ != null) {
		result.addClass(class_);
		if (generateDefinitionLabels) {
			result.addDefinitionLabel(model.createLiteral(
					Microsyntax.toString(table)));
		}
	}
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:24,代碼來源:D2RQTarget.java

示例4: addDecisionStatusToModel

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
/**
    * Add to the model the decision statuses.
    * 
    * @param Model the model we are currently working with
    */
public void addDecisionStatusToModel(Model model) {
	
	List<String> statusesList = Arrays.asList("Published", "Pending_Revocation", "Revoked", "Submitted");
	
	for (String status : statusesList) {
		String[] statusDtls = hm.findDecisionStatusIndividual(status);
		/** statusResource **/
		Resource statusResource = model.createResource(statusDtls[0], Ontology.decisionStatusResource);
		model.createResource(statusDtls[0], Ontology.conceptResource);
		/** configure prefLabel **/
		statusResource.addProperty(Ontology.prefLabel, statusDtls[1], "el");
		statusResource.addProperty(Ontology.prefLabel, statusDtls[2], "en");
       }
	
}
 
開發者ID:YourDataStories,項目名稱:harvesters,代碼行數:21,代碼來源:MonthlyRdfActions.java

示例5: getAgentUriNoVat

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
public Resource getAgentUriNoVat(VirtGraph graphOrgs, String vatId) {
	
	Resource agentUri = null;
	
	String queryUri = "PREFIX gr: <http://purl.org/goodrelations/v1#> " +
				"SELECT DISTINCT ?org " +
				"FROM <" + QueryConfiguration.queryGraphOrganizations + "> " +
				"WHERE { " +
				"?org rdf:type foaf:Organization . " +
				"FILTER (STR(?org) = \"http://linkedeconomy.org/resource/Organization/" + vatId + "\") . " +
				"}";

	VirtuosoQueryExecution vqeUri = VirtuosoQueryExecutionFactory.create(queryUri, graphOrgs);		
	ResultSet resultsUri = vqeUri.execSelect();
	
	if (resultsUri.hasNext()) {
		QuerySolution result = resultsUri.nextSolution();
		agentUri = result.getResource("org");
	}
	
	vqeUri.close();
	
	return agentUri;
}
 
開發者ID:YourDataStories,項目名稱:harvesters,代碼行數:25,代碼來源:Queries.java

示例6: open

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
public Object open(Assembler ignore, Resource description, Mode ignore2) {
	if (!description.hasProperty(D2RQ.mappingFile)) {
		throw new D2RQException("Error in assembler specification " + description + ": missing property d2rq:mappingFile");
	}
	if (!description.getProperty(D2RQ.mappingFile).getObject().isURIResource()) {
		throw new D2RQException("Error in assembler specification " + description + ": value of d2rq:mappingFile must be a URI");
	}
	String mappingFileURI = ((Resource) description.getProperty(D2RQ.mappingFile).getObject()).getURI();
	String resourceBaseURI = null;
	Statement stmt = description.getProperty(D2RQ.resourceBaseURI);
	if (stmt != null) {
		if (!stmt.getObject().isURIResource()) {
			throw new D2RQException("Error in assembler specification " + description + ": value of d2rq:resourceBaseURI must be a URI");
		}
		resourceBaseURI = ((Resource) stmt.getObject()).getURI();
	}
	return new ModelD2RQ(mappingFileURI, null, resourceBaseURI);
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:19,代碼來源:D2RQAssembler.java

示例7: addDecisionStatusToModel

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
/**
 * Add to the model the decision statuses.
 * 
 * @param Model
 *            the model we are currently working with
 */
public void addDecisionStatusToModel(Model model) {

	List<String> statusesList = Arrays.asList("Published", "Pending_Revocation", "Revoked", "Submitted");

	for (String status : statusesList) {
		String[] statusDtls = hm.findDecisionStatusIndividual(status);
		/** statusResource **/
		Resource statusResource = model.createResource(statusDtls[0], Ontology.decisionStatusResource);
		model.createResource(statusDtls[0], Ontology.conceptResource);
		/** configure prefLabel **/
		statusResource.addProperty(Ontology.prefLabel, statusDtls[1], "el");
		statusResource.addProperty(Ontology.prefLabel, statusDtls[2], "en");
	}

}
 
開發者ID:YourDataStories,項目名稱:harvesters,代碼行數:22,代碼來源:MonthlyRdfActions.java

示例8: addKanonistikiToModel

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
/**
 * Add to the model the Regular Acts.
 * 
 * @param Model
 *            the model we are currently working with
 */
public void addKanonistikiToModel(Model model) {

	List<String> regularList = Arrays.asList("Υπουργική Απόφαση",
			"Πράξη Γενικού Γραμματέα Αποκεντρωμένης Διοίκησης", "Πράξη Οργάνου Διοίκησης Ν.Π.Δ.Δ.",
			"Πράξη Οργάνου Διοίκησης ΟΤΑ Α’ και Β’ Βαθμού (και εποπτευόμενων φορέων τους)",
			"Λοιπές Κανονιστικές Πράξεις");

	for (String regular : regularList) {
		String[] regularDtls = hm.findKanonistikiIndividual(regular);
		/** regulatoryResource **/
		Resource regularResource = model.createResource(regularDtls[0], Ontology.regulatoryActResource);
		model.createResource(regularDtls[0], Ontology.conceptResource);
		/** configure prefLabel **/
		regularResource.addProperty(Ontology.prefLabel, regularDtls[1], "el");
		regularResource.addProperty(Ontology.prefLabel, regularDtls[2], "en");
	}

}
 
開發者ID:YourDataStories,項目名稱:harvesters,代碼行數:25,代碼來源:MonthlyRdfActions.java

示例9: addTimePeriodToModel

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
/**
 * Add to the model the Time Period.
 * 
 * @param Model
 *            the model we are currently working with
 */
public void addTimePeriodToModel(Model model) {

	List<String> timeList = Arrays.asList("Έτος", "ΝΟΕΜΒΡΙΟΣ", "ΟΚΤΩΒΡΙΟΣ", "Τρίμηνο");

	for (String time : timeList) {
		String[] timeDtls = hm.findTimePeriodIndividual(time);
		/** timeResource **/
		Resource timeResource = model.createResource(timeDtls[0], Ontology.timeResource);
		model.createResource(timeDtls[0], Ontology.conceptResource);
		/** configure prefLabel **/
		timeResource.addProperty(Ontology.prefLabel, timeDtls[1], "el");
		timeResource.addProperty(Ontology.prefLabel, timeDtls[2], "en");
	}

}
 
開發者ID:YourDataStories,項目名稱:harvesters,代碼行數:22,代碼來源:MonthlyRdfActions.java

示例10: doGet

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	D2RServer server = D2RServer.fromServletContext(getServletContext());
	server.checkMappingFileChanged();
	if (request.getPathInfo() == null) {
		new ModelResponse(classMapListModel(), request, response).serve();
		return;
	}
	String classMapName = request.getPathInfo().substring(1);
	Model resourceList = getClassMapLister().classMapInventory(classMapName);
	if (resourceList == null) {
		response.sendError(404, "Sorry, class map '" + classMapName + "' not found.");
		return;
	}
   	Resource classMap = resourceList.getResource(server.baseURI() + "all/" + classMapName);
   	Resource directory = resourceList.createResource(server.baseURI() + "all");
   	classMap.addProperty(RDFS.seeAlso, directory);
   	classMap.addProperty(RDFS.label, "List of all instances: " + classMapName);
   	directory.addProperty(RDFS.label, "D2R Server contents");
   	server.addDocumentMetadata(resourceList, classMap);
	new ModelResponse(resourceList, request, response).serve();
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:22,代碼來源:ClassMapServlet.java

示例11: addBudgetTypeToModel

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
/**
 * Add to the model the budget types.
 * 
 * @param Model
 *            the model we are currently working with
 */
public void addBudgetTypeToModel(Model model) {

	List<String> budgetTypeList = Arrays.asList("Τακτικός Προϋπολογισμός", "Πρόγραμμα Δημοσίων Επενδύσεων",
			"Ίδια Έσοδα", "Συγχρηματοδοτούμενο Έργο");

	for (String budgetType : budgetTypeList) {
		String[] budgetDtls = hm.findBudgetTypeIndividual(budgetType);
		/** statusResource **/
		Resource statusResource = model.createResource(budgetDtls[0], Ontology.budgetCategoryResource);
		model.createResource(budgetDtls[0], Ontology.conceptResource);
		/** configure prefLabel **/
		statusResource.addProperty(Ontology.prefLabel, budgetDtls[1], "el");
		statusResource.addProperty(Ontology.prefLabel, budgetDtls[2], "en");
	}

}
 
開發者ID:YourDataStories,項目名稱:harvesters,代碼行數:23,代碼來源:MonthlyRdfActions.java

示例12: handleDownload

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
private boolean handleDownload(String resourceURI, HttpServletResponse response, D2RServer server) throws IOException {
	Mapping m = D2RServer.retrieveSystemLoader(getServletContext()).getMapping();
	for (Resource r: m.downloadMapResources()) {
		DownloadMap d = m.downloadMap(r);
		DownloadContentQuery q = new DownloadContentQuery(d, resourceURI);
		if (q.hasContent()) {
			response.setContentType(q.getMediaType() != null ? q.getMediaType() : "application/octet-stream");
			InputStream is = q.getContentStream();
			OutputStream os = response.getOutputStream();
			final byte[] buffer = new byte[0x10000];
			int read;
			do {
				read = is.read(buffer, 0, buffer.length);
				if (read>0) {
					os.write(buffer, 0, read);
				}
			} while (read >= 0);
			is.close();
			q.close();
			return true;
		}
	}
	return false;
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:25,代碼來源:ResourceServlet.java

示例13: Message

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
/**
 * @param problem
 * @param term
 * @param detailCode Optional error code; indicates a subclass of problems
 * @param details Optional string containing error details
 * @param contextResource May be null
 * @param contextProperty May be null
 */
public Message(Problem problem, MappingTerm term, 
		String detailCode, String details, 
		Resource contextResource, Property contextProperty) {
	this.problem = problem;
	this.subject = contextResource; 
	this.predicates = 
		contextProperty == null 
				? Collections.<Property>emptyList() 
				: Collections.singletonList(contextProperty);
	this.objects = 
		term == null
				? Collections.<RDFNode>emptyList()
				: Collections.<RDFNode>singletonList(ResourceFactory.createPlainLiteral(term.toString()));
	this.detailCode = detailCode;
	this.details = details;
	this.cause = null;
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:26,代碼來源:Message.java

示例14: findTemplateFile

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
public static File findTemplateFile(D2RServer server,
		Property fileConfigurationProperty) {
	Resource config = server.getConfig().findServerResource();
	if (config == null || !config.hasProperty(fileConfigurationProperty)) {
		return null;
	}
	String metadataTemplate = config.getProperty(fileConfigurationProperty)
			.getString();

	String templatePath;
	if (metadataTemplate.startsWith(File.separator)) {
		templatePath = metadataTemplate;
	} else {
		File mappingFile = new File(server.getConfig()
				.getLocalMappingFilename());
		String folder = mappingFile.getParent();
		if (folder != null) {
			templatePath = folder + File.separator + metadataTemplate;
		} else {
			templatePath = metadataTemplate;
		}

	}
	File f = new File(templatePath);
	return f;
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:27,代碼來源:MetadataCreator.java

示例15: testContainment

import com.hp.hpl.jena.rdf.model.Resource; //導入依賴的package包/類
@Test
public void testContainment() {
	assertTrue(Containment.checkContainment(sampleCompany));
	// add the manager of the research department also to the development
	// department (as employee)
	Resource craig = sampleCompany.getModel()
			.getResource(sampleCompany.NS_COMPANY + "craig");
	sampleCompany.getModel()
			.getResource(sampleCompany.NS_COMPANY + "development")
				.getProperty(sampleCompany.EMPLOYEES)
					.getBag()
						.add(craig);
	
	assertFalse(Containment.checkContainment(sampleCompany));
}
 
開發者ID:amritbhat786,項目名稱:DocIT,代碼行數:16,代碼來源:Tests.java


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