/** * Tr term frame clauses. * * @param cls the cls * @param clauses the clauses * @param t the t * @return the sets the */ public Set<OWLAxiom> trTermFrameClauses(OWLClass cls, Collection<Clause> clauses, String t) { OboFormatTag tag = OBOFormatConstants.getTag(t); Set<OWLAxiom> axioms = new HashSet<>(); if (tag == OboFormatTag.TAG_INTERSECTION_OF) { axioms.add(trIntersectionOf(cls, clauses)); } else if (tag == OboFormatTag.TAG_UNION_OF) { axioms.add(trUnionOf(cls, clauses)); } else { clauses.forEach(c -> axioms.add(trTermClause(cls, t, c))); } return axioms; }
/** * @param d date to format * @return formatted string */ public static String format(Date d) { return OBOFormatConstants.headerDateFormat().format(d); }
OboFormatTag tag = null; if (tagString != null) { tag = OBOFormatConstants.getTag(tagString); try { clause.addValue( OBOFormatConstants.headerDateFormat().parseObject(value.toString())); } catch (@SuppressWarnings("unused") ParseException e) { error("Could not parse date string: " + value, true);
/** * Tr term frame clauses. * * @param cls the cls * @param clauses the clauses * @param t the t * @return the sets the */ public Set<OWLAxiom> trTermFrameClauses(OWLClass cls, Collection<Clause> clauses, String t) { OboFormatTag tag = OBOFormatConstants.getTag(t); Set<OWLAxiom> axioms = new HashSet<>(); if (tag == OboFormatTag.TAG_INTERSECTION_OF) { axioms.add(trIntersectionOf(cls, clauses)); } else if (tag == OboFormatTag.TAG_UNION_OF) { axioms.add(trUnionOf(cls, clauses)); } else { clauses.forEach(c -> axioms.add(trTermClause(cls, t, c))); } return axioms; }
/** * @param d date to format * @return formatted string */ public static String format(Date d) { return OBOFormatConstants.headerDateFormat().format(d); }
/** * Tr term frame clauses. * * @param cls the cls * @param clauses the clauses * @param t the t * @return the sets the */ public Set<OWLAxiom> trTermFrameClauses(OWLClass cls, Collection<Clause> clauses, String t) { OboFormatTag tag = OBOFormatConstants.getTag(t); Set<OWLAxiom> axioms = new HashSet<>(); if (tag == OboFormatTag.TAG_INTERSECTION_OF) { axioms.add(trIntersectionOf(cls, clauses)); } else if (tag == OboFormatTag.TAG_UNION_OF) { axioms.add(trUnionOf(cls, clauses)); } else { clauses.forEach(c -> axioms.add(trTermClause(cls, t, c))); } return axioms; }
/** * @param d date to format * @return formatted string */ public static String format(Date d) { return OBOFormatConstants.headerDateFormat().format(d); }
/** * Tr term frame clauses. * * @param cls the cls * @param clauses the clauses * @param t the t * @return the sets the */ public Set<OWLAxiom> trTermFrameClauses(OWLClass cls, Collection<Clause> clauses, String t) { OboFormatTag tag = OBOFormatConstants.getTag(t); Set<OWLAxiom> axioms = new HashSet<>(); if (tag == OboFormatTag.TAG_INTERSECTION_OF) { axioms.add(trIntersectionOf(cls, clauses)); } else if (tag == OboFormatTag.TAG_UNION_OF) { axioms.add(trUnionOf(cls, clauses)); } else { clauses.forEach(c -> axioms.add(trTermClause(cls, t, c))); } return axioms; }
/** * @param d date to format * @return formatted string */ public static String format(Date d) { return OBOFormatConstants.headerDateFormat().format(d); }
/** * @param doc doc * @return list of references * @throws OBOFormatDanglingReferenceException dangling reference error */ public List<String> checkDanglingReferences(OBODoc doc) { List<String> danglingReferences = new ArrayList<>(); // check term frames for (Frame f : doc.getTermFrames()) { for (String tag : f.getTags()) { OboFormatTag tagconstant = OBOFormatConstants.getTag(tag); Clause c = f.getClause(tag); validate(doc, danglingReferences, f, tag, tagconstant, c); } } // check typedef frames for (Frame f : doc.getTypedefFrames()) { for (String tag : f.getTags()) { OboFormatTag tagConstant = OBOFormatConstants.getTag(tag); Clause c = f.getClause(tag); validate1(doc, danglingReferences, f, tag, tagConstant, c); } } return danglingReferences; }
private static void writeHeaderDate(Clause clause, Writer writer) throws IOException { StringBuilder sb = new StringBuilder(); sb.append(clause.getTag()); sb.append(": "); Object value = clause.getValue(); if (value instanceof Date) { sb.append(OBOFormatConstants.headerDateFormat().format((Date) value)); } else if (value instanceof String) { sb.append(value); } else { if (LOG.isWarnEnabled()) { LOG.warn("Unknown datatype ('{}') for value in clause: {}", value.getClass().getName(), clause); sb.append(value); } } writeLine(sb, writer); }
/** * @param doc doc * @return list of references * @throws OBOFormatDanglingReferenceException dangling reference error */ public List<String> checkDanglingReferences(OBODoc doc) { List<String> danglingReferences = new ArrayList<>(); // check term frames for (Frame f : doc.getTermFrames()) { for (String tag : f.getTags()) { OboFormatTag tagconstant = OBOFormatConstants.getTag(tag); Clause c = f.getClause(tag); validate(doc, danglingReferences, f, tag, tagconstant, c); } } // check typedef frames for (Frame f : doc.getTypedefFrames()) { for (String tag : f.getTags()) { OboFormatTag tagConstant = OBOFormatConstants.getTag(tag); Clause c = f.getClause(tag); validate1(doc, danglingReferences, f, tag, tagConstant, c); } } return danglingReferences; }
private static void writeHeaderDate(Clause clause, Writer writer) throws IOException { StringBuilder sb = new StringBuilder(); sb.append(clause.getTag()); sb.append(": "); Object value = clause.getValue(); if (value instanceof Date) { sb.append(OBOFormatConstants.headerDateFormat().format((Date) value)); } else if (value instanceof String) { sb.append(value); } else { if (LOG.isWarnEnabled()) { LOG.warn("Unknown datatype ('{}') for value in clause: {}", value.getClass().getName(), clause); sb.append(value); } } writeLine(sb, writer); }
/** * @param doc doc * @return list of references * @throws OBOFormatDanglingReferenceException dangling reference error */ public List<String> checkDanglingReferences(OBODoc doc) { List<String> danglingReferences = new ArrayList<>(); // check term frames for (Frame f : doc.getTermFrames()) { for (String tag : f.getTags()) { OboFormatTag tagconstant = OBOFormatConstants.getTag(tag); Clause c = f.getClause(tag); validate(doc, danglingReferences, f, tag, tagconstant, c); } } // check typedef frames for (Frame f : doc.getTypedefFrames()) { for (String tag : f.getTags()) { OboFormatTag tagConstant = OBOFormatConstants.getTag(tag); Clause c = f.getClause(tag); validate1(doc, danglingReferences, f, tag, tagConstant, c); } } return danglingReferences; }
private static void writeHeaderDate(Clause clause, Writer writer) throws IOException { StringBuilder sb = new StringBuilder(); sb.append(clause.getTag()); sb.append(": "); Object value = clause.getValue(); if (value instanceof Date) { sb.append(OBOFormatConstants.headerDateFormat().format((Date) value)); } else if (value instanceof String) { sb.append(value); } else { if (LOG.isWarnEnabled()) { LOG.warn("Unknown datatype ('{}') for value in clause: {}", value.getClass().getName(), clause); sb.append(value); } } writeLine(sb, writer); }
/** * @param doc doc * @return list of references * @throws OBOFormatDanglingReferenceException dangling reference error */ public List<String> checkDanglingReferences(OBODoc doc) { List<String> danglingReferences = new ArrayList<>(); // check term frames for (Frame f : doc.getTermFrames()) { for (String tag : f.getTags()) { OboFormatTag tagconstant = OBOFormatConstants.getTag(tag); Clause c = f.getClause(tag); validate(doc, danglingReferences, f, tag, tagconstant, c); } } // check typedef frames for (Frame f : doc.getTypedefFrames()) { for (String tag : f.getTags()) { OboFormatTag tagConstant = OBOFormatConstants.getTag(tag); Clause c = f.getClause(tag); validate1(doc, danglingReferences, f, tag, tagConstant, c); } } return danglingReferences; }
private static void writeHeaderDate(Clause clause, Writer writer) throws IOException { StringBuilder sb = new StringBuilder(); sb.append(clause.getTag()); sb.append(": "); Object value = clause.getValue(); if (value instanceof Date) { sb.append(OBOFormatConstants.headerDateFormat().format((Date) value)); } else if (value instanceof String) { sb.append(value); } else { if (LOG.isWarnEnabled()) { LOG.warn("Unknown datatype ('{}') for value in clause: {}", value.getClass().getName(), clause); sb.append(value); } } writeLine(sb, writer); }
protected void parseIdLine(Frame f) { String t = getParseTag(); OboFormatTag tag = OBOFormatConstants.getTag(t); if (tag != OboFormatTag.TAG_ID) { error("Expected id tag as first line in frame, but was: " + tag); } Clause cl = new Clause(t); f.addClause(cl); String id = getParseUntil(" !{"); if (id.isEmpty()) { error("Could not find an valid id, id is empty."); } cl.addValue(id); f.setId(id); parseEOL(cl); }
/** * Tr literal. * * @param inputValue the value * @return the oWL annotation value */ protected OWLAnnotationValue trLiteral(Object inputValue) { Object value = inputValue; if (value instanceof Xref) { value = ((Xref) value).getIdref(); } else if (value instanceof Date) { // use proper OWL2 data type, write lexical value as ISO 8601 date // string String lexicalValue = OBOFormatConstants.headerDateFormat().format((Date) value); return fac.getOWLLiteral(lexicalValue, OWL2Datatype.XSD_DATE_TIME); } else if (value instanceof Boolean) { return fac.getOWLLiteral(((Boolean) value).booleanValue()); } else if (!(value instanceof String)) { // TODO // e.g. boolean value = value.toString(); } String value2 = (String) value; // TODO return fac.getOWLLiteral(value2); }
protected void parseIdLine(Frame f) { String t = getParseTag(); OboFormatTag tag = OBOFormatConstants.getTag(t); if (tag != OboFormatTag.TAG_ID) { error("Expected id tag as first line in frame, but was: " + tag); } Clause cl = new Clause(t); f.addClause(cl); String id = getParseUntil(" !{"); if (id.isEmpty()) { error("Could not find an valid id, id is empty."); } cl.addValue(id); f.setId(id); parseEOL(cl); }