本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}