Java Code Examples for org.semanticweb.owlapi.model.OWLAnnotationValue#toString()
The following examples show how to use
org.semanticweb.owlapi.model.OWLAnnotationValue#toString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OntologyAnnotation.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
public OntologyAnnotation(OWLAnnotation ann) { property = ann.getProperty().getIRI().toString(); OWLAnnotationValue v = ann.getValue(); if (v instanceof IRI) { value = v.toString(); } else { OWLLiteral lit = ((OWLLiteral)v); value = lit.getLiteral().toString(); } }
Example 2
Source File: AxiomCopier.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
private AnnTuple getAnnTuple(OWLAnnotationAssertionAxiom aax) { String v; OWLAnnotationValue av = aax.getValue(); if (av instanceof OWLLiteral) { v = ((OWLLiteral)av).getLiteral(); } else { v = av.toString(); } v = v.toLowerCase(); return new AnnTuple((IRI)aax.getSubject(), v); }
Example 3
Source File: OntologyMetadataMarkdownWriter.java From owltools with BSD 3-Clause "New" or "Revised" License | 4 votes |
public static String renderMarkdown(OWLGraphWrapper g, String baseDir, boolean isIncludeImage) { OWLOntology ont = g.getSourceOntology(); StringBuilder out = new StringBuilder(); String ontId = g.getOntologyId(); Set<OWLAnnotation> oAnns = ont.getAnnotations(); System.err.println("NUM1:"+oAnns.size()); String title = getVal("title", oAnns); out.append("## Ontology: "+title+"\n\n"); out.append("IRI: "+rurl(ont)+"\n\n"); String desc = getVal("description", oAnns); out.append("### Description\n\n"); out.append(desc+"\n\n"); Set<OWLOntology> imports = ont.getImports(); if (imports.size() > 0) { out.append("### Imports\n\n"); for (OWLOntology im : imports) { out.append(" * "+rurl(im)+"\n"); } } if (isIncludeImage) { String imgFn = baseDir + "/" + ontId + ".png"; out.append("![]("+imgFn+")\n\n"); } System.err.println("NUM:"+oAnns.size()); if (oAnns.size() > 0) { out.append("### Annotations:\n\n"); for (OWLAnnotation ann : oAnns) { String annLabel = g.getLabelOrDisplayId(ann.getProperty()); OWLAnnotationValue v = ann.getValue(); String dv = v.toString(); if (v instanceof OWLLiteral) { OWLLiteral lv = ((OWLLiteral)v); dv = lv.getLiteral(); IRI dt = lv.getDatatype().getIRI(); //System.out.println("DT = "+dt); if (dt.equals(OWL2Datatype.XSD_ANY_URI.getIRI())) { dv = href(lv.getLiteral()); } } out.append(" * "+href(ann.getProperty().getIRI().toString(),annLabel)+" : "+dv+"\n"); } } return out.toString(); }