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


Java OntResource.getURI方法代码示例

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


在下文中一共展示了OntResource.getURI方法的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: getLiteralMatchingDataPropertyRange

import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
/**
 * Call this method to convert a value (v) as a Java object to a typed 
 * Literal matching the range of the property.
 *
 * @param m
 * @param prop
 * @param v
 * @return
 * @throws CircularDependencyException 
 */
public static synchronized Literal getLiteralMatchingDataPropertyRange(OntModel m, OntProperty prop, Object v) throws TranslationException {
    Literal val = null;
    String errMsg = null;
    if (prop == null || prop.isAnnotationProperty()) {
    	return m.createTypedLiteral(v);
    }
    // SADL only has DoubleLiterals--if this property has range float convert v to Float.
    OntResource rng = prop.getRange();
    String rnguri = rng != null ? rng.getURI() : null;
    if (rng == null) {
        errMsg = "Range not given.";
    }
    else if (rng.isAnon()) {
        // this is a complex range--needs work. Try to do something with it....
        // If value is a String
        if (v instanceof String) {
            v = stripQuotes((String)v);
            val = m.createTypedLiteral(v);                
        }
        else {
            val = m.createTypedLiteral(v);
            if (val == null) {
                errMsg = "Range is an unsupported complex type, failed to create a Literal value for '" + v.toString() + "'.";
            }
        }
    }
    else {           
    	val = getLiteralMatchingDataPropertyRange(m, rnguri, v);
    }
    if (errMsg != null) {
    	errMsg += " (Property is '" + prop.getLocalName() + "'.)";
        throw new TranslationException(errMsg);
    }
    return val;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:46,代码来源:SadlUtils.java

示例4: getLiteralMatchingDataPropertyRange

import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
/**
 * Call this method to convert a value (v) as a Java object to a typed 
 * Literal matching the range of the property.
 *
 * @param m
 * @param prop
 * @param v
 * @return
 * @throws Exception
 */
public static synchronized Literal getLiteralMatchingDataPropertyRange(OntModel m, OntProperty prop, Object v) throws Exception {
    Literal val = null;
    String errMsg = null;
    if (prop.isAnnotationProperty()) {
    	return m.createTypedLiteral(v);
    }
    // SADL only has DoubleLiterals--if this property has range float convert v to Float.
    OntResource rng = prop.getRange();
    String rnguri = rng != null ? rng.getURI() : null;
    if (rng == null) {
        errMsg = "Range not given.";
    }
    else if (rng.isAnon()) {
        // this is a complex range--needs work. Try to do something with it....
        // If value is a String
        if (v instanceof String) {
            v = stripQuotes((String)v);
            val = m.createTypedLiteral(v);                
        }
        else {
            val = m.createTypedLiteral(v);
            if (val == null) {
                errMsg = "Range is an unsupported complex type, failed to create a Literal value for '" + v.toString() + "'.";
            }
        }
    }
    else {
    	val = getLiteralMatchingDataPropertyRange(m, rnguri, v);
    }
    if (errMsg != null) {
    	errMsg += " (Property is '" + prop.getLocalName() + "'.)";
        throw new Exception(errMsg);
    }
    return val;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:46,代码来源:UtilsForJena.java


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