本文整理汇总了Java中com.hp.hpl.jena.ontology.OntProperty.getDomain方法的典型用法代码示例。如果您正苦于以下问题:Java OntProperty.getDomain方法的具体用法?Java OntProperty.getDomain怎么用?Java OntProperty.getDomain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.ontology.OntProperty
的用法示例。
在下文中一共展示了OntProperty.getDomain方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDomain
import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private OntResource getDomain(OntProperty prop) {
OntResource domain = prop.getDomain();
if (domain == null) {
if (prop.canAs(ObjectProperty.class)) {
ExtendedIterator<? extends OntProperty> titr = ((ObjectProperty) prop
.as(ObjectProperty.class)).listSuperProperties(true);
while (titr.hasNext()) {
OntProperty tr = titr.next();
domain = getDomain((OntProperty) tr);
if (domain != null) {
titr.close();
return domain;
}
}
titr.close();
}
}
return domain;
}
示例2: updatePropertyDomain
import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private boolean updatePropertyDomain(int argIdx, OntProperty prop,
ConceptIdentifier domain) {
boolean retval = false;
OntResource domainCls = conceptIdentifierToOntClass(argIdx, 0, domain);
OntResource existingDomain = prop.getDomain();
if (domainCls != null) {
domainCls = addClassToUnionClass(existingDomain,
(OntClass) domainCls);
if (existingDomain != null) {
if (!existingDomain.equals(domainCls)) {
if (prop.getNameSpace().equals(getModelNamespace())) {
prop.removeDomain(existingDomain);
prop.addDomain(domainCls);
}
else {
// this is changing the domain of a property defined in a different model
getJenaModel().add(prop, RDFS.domain, domainCls);
}
}
retval = true; // return true if it was already the domain
} else {
if (prop.getNameSpace().equals(getModelNamespace())) {
prop.addDomain(domainCls);
}
else {
getJenaModel().add(prop, RDFS.domain, domainCls);
}
retval = true;
}
} else {
addError(argIdx, ExistingNamePart.NOTAPPLICABLE,
"Unable to convert domain identifier (" + domain
+ ") to a class.");
}
return retval;
}
示例3: validateClassInDomain
import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
public boolean validateClassInDomain(NamedNode pred, NamedNode domainClass) {
if (beginDeepValidation()) {
OntProperty prop = getJenaModel().getOntProperty(
pred.toFullyQualifiedString());
if (prop != null) {
OntResource dr = prop.getDomain();
OntClass dcls = getJenaModel().getOntClass(
domainClass.toFullyQualifiedString());
if (dcls != null) {
if (dr == null) {
ExtendedIterator<? extends OntProperty> spitr = prop.listSuperProperties();
while (spitr.hasNext()) {
OntProperty sprop = spitr.next();
dr = sprop.getDomain();
if (dr != null) {
if (classIsSubclassOf(dcls, dr, true)) {
spitr.close();
endDeepValidation();
return true;
}
}
}
spitr.close();
}
else {
boolean bresult = classIsSubclassOf(dcls, dr, true); // dr.as(OntClass.class), dcls);
endDeepValidation();
return bresult;
}
}
}
}
return true; // annotation properties aren't OntProperties
}
示例4: validateClassInRange
import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
public boolean validateClassInRange(NamedNode pred, NamedNode rangeClass) {
if (beginDeepValidation()) {
OntProperty prop = getJenaModel().getOntProperty(
pred.toFullyQualifiedString());
if (prop != null && prop.isObjectProperty()) {
OntResource rr = prop.getRange();
OntClass rcls = getJenaModel().getOntClass(
rangeClass.toFullyQualifiedString());
if (rcls != null) {
if (rr == null) {
ExtendedIterator<? extends OntProperty> spitr = prop.listSuperProperties();
while (spitr.hasNext()) {
OntProperty sprop = spitr.next();
rr = sprop.getDomain();
if (rr != null) {
if (classIsSubclassOf(rcls, rr, true)) {
spitr.close();
endDeepValidation();
return true;
}
}
}
spitr.close();
}
else {
boolean breturn = classIsSubclassOf(rcls, rr, true);
endDeepValidation();
return breturn;
}
}
}
else if (prop == null) {
// TODO this might need more checking awc 9/15/2013
return true;
}
endDeepValidation();
return false;
}
return true;
}