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


Java OWLObject.toString方法代码示例

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


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

示例1: owlObjectToObject

import org.semanticweb.owlapi.model.OWLObject; //导入方法依赖的package包/类
private Object owlObjectToObject(OWLObject owlValue) {
    if (owlValue == null) {
        return null;
    }
    if (owlValue instanceof OWLLiteral) {
        return OwlapiUtils.owlLiteralToValue((OWLLiteral) owlValue);
    }
    final Set<OWLEntity> sig = owlValue.getSignature();
    if (sig.isEmpty()) {
        return owlValue.toString();
    } else {
        return URI.create(sig.iterator().next().toStringID());
    }
}
 
开发者ID:kbss-cvut,项目名称:jopa,代码行数:15,代码来源:SelectResultSet.java

示例2: owlValueToString

import org.semanticweb.owlapi.model.OWLObject; //导入方法依赖的package包/类
private String owlValueToString(OWLObject owlValue) {
    if (owlValue instanceof OWLLiteral) {
        return OwlapiUtils.owlLiteralToValue((OWLLiteral) owlValue).toString();
    }
    final Set<OWLEntity> sig = owlValue.getSignature();
    if (sig.isEmpty()) {
        return owlValue.toString();
    } else {
        return sig.iterator().next().toStringID();
    }
}
 
开发者ID:kbss-cvut,项目名称:jopa,代码行数:12,代码来源:SelectResultSet.java

示例3: getLabelOrDisplayId

import org.semanticweb.owlapi.model.OWLObject; //导入方法依赖的package包/类
public String getLabelOrDisplayId(OWLObject c) {
	String label = getLabel(c);
	if (label == null) {
		if (c instanceof OWLNamedObject) {
			OWLNamedObject nc = (OWLNamedObject)c;
			label = nc.getIRI().getFragment();
		}
		else {
			label = c.toString();
		}
	}
	return label;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:14,代码来源:OWLGraphWrapperExtended.java

示例4: convert

import org.semanticweb.owlapi.model.OWLObject; //导入方法依赖的package包/类
public Object convert(OWLObject obj) {
	if (obj instanceof IRI) {
		return obj.toString();
	}
	else if (obj instanceof OWLEntity) {
		return convert(((OWLEntity)obj).getIRI());
	}
	else if (obj instanceof OWLClassExpression) {
		// {type: <Class|SomeValuesFrom|...>,  args: [...]
		Map<String,Object> m = new HashMap<String,Object>();
		m.put("type", ((OWLClassExpression) obj).getClassExpressionType().toString());
		Object[] arr;
		if (obj instanceof OWLQuantifiedObjectRestriction) {
			OWLQuantifiedObjectRestriction r = (OWLQuantifiedObjectRestriction)obj;
			arr = new Object[] {
					 convert(r.getProperty()),
					 convert(r.getFiller())
			};
			// TODO: QCRs
		}
		else if (obj instanceof OWLNaryBooleanClassExpression) {
			arr = convertSet( ((OWLNaryBooleanClassExpression)obj).getOperands());
		}
		else {
			arr = new Object[0];
			// TODO
		}
		m.put("args", arr);
		return m;
	}
	else if (obj instanceof OWLLiteral) {
		return ((OWLLiteral)obj).getLiteral();
	}
	else {
		return obj.toString(); // TODO
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:38,代码来源:OWLGsonParser.java

示例5: printOWLObject

import org.semanticweb.owlapi.model.OWLObject; //导入方法依赖的package包/类
private void printOWLObject(OWLObject obj, String del) {
	String id;
	if (obj instanceof OWLNamedObject) {
		IRI iri = ((OWLNamedObject)obj).getIRI();
		if (iri.getFragment() != null) {
			id = iri.getFragment();
		}
		else {
			id = iri.toString();
			id = id.replaceAll(".*/", "");
		}
	}
	else {
		/*
		if (obj instanceof OWLObjectIntersectionOf) {
			s.print("and");
			for (OWLClassExpression sx : ((OWLObjectIntersectionOf)x).getOperands()) {
				printX(s, sx, depth+1);
			}
		}
		else if (x instanceof OWLObjectUnionOf) {
			s.print("or");
			for (OWLClassExpression sx : ((OWLObjectUnionOf)x).getOperands()) {
				printX(s, sx, depth+1);
			}
		}
		else if (x instanceof OWLQuantifiedRestriction) {
			OWLQuantifiedRestriction qr = (OWLQuantifiedRestriction)x;
			s.print(qr.getProperty().toString()+" "+qr.getClassExpressionType());
			printX(s, qr.getFiller(), depth+1);
		}
		*/

		// todo - show class expressions
		id = obj.toString();
	}
	printStream.print(id);
	String label = graph.getLabel(obj);
	if (label == null) {
		label = "";
	}
	printStream.print(del);
	printStream.print("\'"+label+"\'");		
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:45,代码来源:Reporter.java


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