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