当前位置: 首页>>代码示例>>Java>>正文


Java OntResource.isURIResource方法代码示例

本文整理汇总了Java中com.hp.hpl.jena.ontology.OntResource.isURIResource方法的典型用法代码示例。如果您正苦于以下问题:Java OntResource.isURIResource方法的具体用法?Java OntResource.isURIResource怎么用?Java OntResource.isURIResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.hpl.jena.ontology.OntResource的用法示例。


在下文中一共展示了OntResource.isURIResource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDomain

import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
public Object getDomain(ConceptName prop) {
	OntProperty pr = getOntProperty(prop);
	OntResource rr = getDomain(pr);
	if (rr != null) {
		if (rr.isURIResource()) {
			return rr.getURI();
		}
		else if (rr.isAnon()) {
			List<ConceptName> rngClasses = findAllUriResourcesInAnon(rr);
			return rngClasses;
		}
		else {
			addError(new ModelError("Unexpected range class: " + rr.toString(), ErrorType.ERROR));
		}
	}
	return null;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:18,代码来源:ModelManager.java

示例2: getRange

import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
public Object getRange(ConceptName prop) {
	OntProperty pr = getOntProperty(prop);
	OntResource rr = getRange(pr);
	if (rr != null) {
		if (rr.isURIResource()) {
			return rr.getURI();
		}
		else if (rr.isAnon()) {
			List<ConceptName> rngClasses = findAllUriResourcesInAnon(rr);
			return rngClasses;
		}
		else {
			addError(new ModelError("Unexpected range class: " + rr.toString(), ErrorType.ERROR));
		}
	}
	return null;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:18,代码来源:ModelManager.java

示例3: getListType

import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
private ConceptName getListType(TypeCheckInfo tci) throws TranslationException, InvalidTypeException {
		Node tct = tci.getTypeCheckType();
		if (tct != null) {
			if (tct instanceof NamedNode) {
				try {
					OntResource cls = theJenaModel.getOntResource(((NamedNode)tct).toFullyQualifiedString());
					if (tci.getTypeToExprRelationship().equals(RANGE) || tci.getTypeToExprRelationship().equals(RESTRICTED_TO)) {
						if (cls.isURIResource()) {
//							return new ConceptName(cls.getURI());
							return getModelProcessor().namedNodeToConceptName((NamedNode) tct);
						}
					}
					if (cls != null && cls.canAs(OntClass.class)){
						ConceptName listcn = getListClassType(cls);
						if (listcn != null) {
							return listcn;
						}
					}
				} catch (InvalidNameException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}
		return null;
	}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:27,代码来源:JenaBasedSadlModelValidator.java

示例4: validateStatement

import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
/**
 * Method to actually do the work of validating the statements
 * @param or
 * @param prop
 * @param val
 * @return
 */
private boolean validateStatement(OntResource or, OntProperty prop,
		RDFNode val) {
	boolean retval = true;
	if (beginDeepValidation() ) {
		try {
			if (!prop.isAnnotationProperty()) {
				OntResource dor = getDomain(prop);
				if (dor != null && !instanceBelongsToClass(getJenaModel(), or, dor)) {
					addValidationWarning(or, dor,
							"is not in domain (" + classToString(dor)
									+ ") of property " + prop.getLocalName());
					retval = false;
				}
				if (val != null) {
					OntResource ror = getRange(prop);
					if (ror == null) {
						addWarning(1, prop.toString() + " does not have a range.");
						retval = false;
					}
					else if (!(ror.isURIResource() && isRDFDataType(ror.getURI())) && val instanceof OntResource) {
						if (ror != null
								&& !instanceBelongsToClass(getJenaModel(), (OntResource) val, ror)) {
							addValidationWarning(
									(OntResource) val,
									ror,
									"is not in the range (" + classToString(ror)
											+ ") of property "
											+ prop.getLocalName());
							retval = false;
						}
					} else if (val instanceof Literal) {
						// no need to look for pending errors here...
						if (!literalValueCompatibleWithRange(ror, (Literal)val)) {
							addError(new ModelError(val.toString()
									+ " is not in range (" + classToString(ror)
									+ ") of property " + prop.getLocalName(),
									ErrorType.WARNING));
							retval = false;
						}
					}
				}
			}
		} catch (Throwable t) {
			if (t.getMessage() == null) {
				t.printStackTrace();
			}
			logger.error("Failed to validate statement: "
					+ t.getLocalizedMessage());
		}
		endDeepValidation();
	}
	return retval;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:61,代码来源:ModelManager.java


注:本文中的com.hp.hpl.jena.ontology.OntResource.isURIResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。