private RDFTriple readTriples() { int mark = input.setHardMark(); int ch = input.read(); #if DEBUG if (!((ch >= 0))) { throw new InvalidOperationException("ch>=0"); } #endif input.setMarkPosition(mark); RDFTerm subject = readObject(false); if (!skipWhitespace()) { throw new ParserException(); } if (input.read() != '<') { throw new ParserException(); } RDFTerm predicate = RDFTerm.fromIRI(readIriReference()); if (!skipWhitespace()) { throw new ParserException(); } RDFTerm obj = readObject(true); skipWhitespace(); if (input.read() != '.') { throw new ParserException(); } skipWhitespace(); RDFTriple ret = new RDFTriple(subject, predicate, obj); endOfLine(input.read()); return(ret); }
private RDFTerm readObject(bool acceptLiteral) { int ch = input.read(); if (ch < 0) { throw new ParserException(); } else if (ch == '<') { return(RDFTerm.fromIRI(readIriReference())); } else if (acceptLiteral && (ch == '\"')) // start of quote literal { string str = readStringLiteral(ch); return(finishStringLiteral(str)); } else if (ch == '_') // Blank Node Label { if (input.read() != ':') { throw new ParserException(); } string label = readBlankNodeLabel(); RDFTerm term = bnodeLabels[label]; if (term == null) { term = RDFTerm.fromBlankNode(label); bnodeLabels.Add(label, term); } return(term); } else { throw new ParserException(); } }