本文整理汇总了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());
}
}
示例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();
}
}
示例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;
}
示例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
}
}
示例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+"\'");
}