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


Java Model.containsResource方法代碼示例

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


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

示例1: createSupervisorOrganization

import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
/**
    * Add to the model the supervisor of the current Organization
    * 
    * @param Model the model we are currently working with
    * @param Resource the current organization
    * @param Organization the supervisor of the organization
    */
private void createSupervisorOrganization(Model model, Resource orgResource, Organization supervisor) {
	
	Resource supervisorResource = model.getResource(Ontology.instancePrefix + "Organization/" + supervisor.getVatNumber());
	
	if (model.containsResource(supervisorResource)) {
		orgResource.addProperty(Ontology.hasSupervisorOrganization, supervisorResource);
	} else {
		supervisorResource = model.createResource(Ontology.instancePrefix + "Organization/" + supervisor.getVatNumber(), Ontology.organizationResource);
           model.createResource(Ontology.instancePrefix + "Organization/" + supervisor.getVatNumber(), Ontology.businessEntityResource);
           model.createResource(Ontology.instancePrefix + "Organization/" + supervisor.getVatNumber(), Ontology.orgOrganizationResource);
           model.createResource(Ontology.instancePrefix + "Organization/" + supervisor.getVatNumber(), Ontology.registeredOrganizationResource);
           
           if (supervisor.getVatNumber() != "") {
           	supervisorResource.addLiteral(Ontology.vatId, supervisor.getVatNumber());
           } else {
           	supervisorResource.addLiteral(Ontology.vatId, "Empty vatID");
           }
           
           supervisorResource.addLiteral(Ontology.organizationId, supervisor.getUid());
           
           /** organization - Supervisor **/
		orgResource.addProperty(Ontology.hasSupervisorOrganization, supervisorResource);
	}
	
}
 
開發者ID:YourDataStories,項目名稱:harvesters,代碼行數:33,代碼來源:MonthlyRdfActions.java

示例2: createFekResource

import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
/**
    * Add to the model the the Fek that is related to the Organization
    * 
    * @param Model the model we are currently working with
    * @param Resource the resource of the related organization
    * @param String the issue type of the Fek 
    * @param String the year that Fek was published 
    * @param String the number of the Fek 
    */
private void createFekResource(Model model, Resource orgResource, String fekIssue, String fekYear, String fekNumber, boolean newOrganizationFlag) {
	
	String fekUriName = "";
	
	if ( (fekIssue != null) && (fekIssue != "") ) {
		fekUriName =  fekIssue + "/" + fekYear + "/" + fekNumber;
	} else {
		fekUriName = fekYear + "/" + fekNumber;
	}
	
	Resource fekResource = model.getResource(Ontology.instancePrefix  + "Fek/" + fekUriName);
	
	if (model.containsResource(fekResource)) { //if Fek resource exists use it
		orgResource.addProperty(Ontology.relatedFek, fekResource);
	} else { //...else create it
		fekResource = model.createResource(Ontology.instancePrefix + "Fek/" + fekUriName, Ontology.fekResource);
		fekResource.addProperty(Ontology.fekNumber, fekNumber);
		fekResource.addProperty(Ontology.fekYear, fekYear);
		if ( (fekIssue != null) && (fekIssue != "") ) {
			fekResource.addProperty(Ontology.fekIssue, model.getResource(Ontology.instancePrefix + "FekType/" + fekIssue));
		}
	}
	
	/** Organization - FEK **/
	if (newOrganizationFlag) {
		orgResource.addProperty(Ontology.relatedFek, fekResource);
	} else {
		orgResource.removeAll(Ontology.relatedFek); //delete the old relationships
		orgResource.addProperty(Ontology.relatedFek, fekResource);
	}
	
}
 
開發者ID:YourDataStories,項目名稱:harvesters,代碼行數:42,代碼來源:MonthlyRdfActions.java

示例3: createFekResource

import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
/**
 * Add to the model the the Fek that is related to the Organization
 * 
 * @param Model
 *            the model we are currently working with
 * @param Resource
 *            the resource of the related organization
 * @param String
 *            the issue type of the Fek
 * @param String
 *            the year that Fek was published
 * @param String
 *            the number of the Fek
 */
private void createFekResource(Model model, Resource orgResource, String fekIssue, String fekYear, String fekNumber,
		boolean newOrganizationFlag) {

	String fekUriName = "";

	if ((fekIssue != null) && (fekIssue != "")) {
		fekUriName = fekIssue + "/" + fekYear + "/" + fekNumber;
	} else {
		fekUriName = fekYear + "/" + fekNumber;
	}

	Resource fekResource = model.getResource(Ontology.instancePrefix + "Fek/" + fekUriName);

	if (model.containsResource(fekResource)) { // if Fek resource exists use
												// it
		orgResource.addProperty(Ontology.relatedFek, fekResource);
	} else { // ...else create it
		fekResource = model.createResource(Ontology.instancePrefix + "Fek/" + fekUriName, Ontology.fekResource);
		fekResource.addProperty(Ontology.fekNumber, fekNumber);
		fekResource.addProperty(Ontology.fekYear, fekYear);
		if ((fekIssue != null) && (fekIssue != "")) {
			fekResource.addProperty(Ontology.fekIssue,
					model.getResource(Ontology.instancePrefix + "FekType/" + fekIssue));
		}
	}

	/** Organization - FEK **/
	if (newOrganizationFlag) {
		orgResource.addProperty(Ontology.relatedFek, fekResource);
	} else {
		orgResource.removeAll(Ontology.relatedFek); // delete the old
													// relationships
		orgResource.addProperty(Ontology.relatedFek, fekResource);
	}

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

示例4: createSupervisorOrganization

import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
/**
 * Add to the model the supervisor of the current Organization
 * 
 * @param Model
 *            the model we are currently working with
 * @param Resource
 *            the current organization
 * @param Organization
 *            the supervisor of the organization
 */
private void createSupervisorOrganization(Model model, Resource orgResource, Organization supervisor) {

	Resource supervisorResource = model
			.getResource(Ontology.instancePrefix + "Organization/" + supervisor.getVatNumber());

	if (model.containsResource(supervisorResource)) {
		orgResource.addProperty(Ontology.hasSupervisorOrganization, supervisorResource);
	} else {
		supervisorResource = model.createResource(
				Ontology.instancePrefix + "Organization/" + supervisor.getVatNumber(),
				Ontology.organizationResource);
		model.createResource(Ontology.instancePrefix + "Organization/" + supervisor.getVatNumber(),
				Ontology.businessEntityResource);
		model.createResource(Ontology.instancePrefix + "Organization/" + supervisor.getVatNumber(),
				Ontology.orgOrganizationResource);
		model.createResource(Ontology.instancePrefix + "Organization/" + supervisor.getVatNumber(),
				Ontology.registeredOrganizationResource);

		if (supervisor.getVatNumber() != "") {
			supervisorResource.addLiteral(Ontology.vatId, supervisor.getVatNumber());
		} else {
			supervisorResource.addLiteral(Ontology.vatId, "Empty vatID");
		}

		supervisorResource.addLiteral(Ontology.organizationId, supervisor.getUid());

		/** organization - Supervisor **/
		orgResource.addProperty(Ontology.hasSupervisorOrganization, supervisorResource);
	}

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


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