@Override public boolean isWellFormedXML() { return literal.isWellFormedXML(); }
public boolean hasWellFormedXML() { return getLiteral().isWellFormedXML(); }
public boolean hasWellFormedXML() { return getLiteral().isWellFormedXML(); }
@Override public boolean isWellFormedXML() throws ReadDeniedException, AuthenticationRequiredException { checkRead(); return holder.getBaseItem().isWellFormedXML(); }
protected void writeLiteral( Literal l, PrintWriter writer ) { String lang = l.getLanguage(); String form = l.getLexicalForm(); if (Util.isLangString(l)) { writer.print(" xml:lang=" + attributeQuoted( lang )); } else if (l.isWellFormedXML() && !blockLiterals) { // RDF XML Literals inline. writer.print(" " + rdfAt("parseType") + "=" + attributeQuoted( "Literal" )+">"); writer.print( form ); return ; } else { // Datatype (if not xsd:string and RDF 1.1) String dt = l.getDatatypeURI(); if ( ! Util.isSimpleString(l) ) writer.print( " " + rdfAt( "datatype" ) + "=" + substitutedAttribute( dt ) ); } // Content. writer.print(">"); writer.print( Util.substituteEntitiesInElementContent( form ) ); }
protected void writeLiteral( Literal l, PrintWriter writer ) { String lang = l.getLanguage(); String form = l.getLexicalForm(); if (Util.isLangString(l)) { writer.print(" xml:lang=" + attributeQuoted( lang )); } else if (l.isWellFormedXML() && !blockLiterals) { // RDF XML Literals inline. writer.print(" " + rdfAt("parseType") + "=" + attributeQuoted( "Literal" )+">"); writer.print( form ); return ; } else { // Datatype (if not xsd:string and RDF 1.1) String dt = l.getDatatypeURI(); if ( ! Util.isSimpleString(l) ) writer.print( " " + rdfAt( "datatype" ) + "=" + substitutedAttribute( dt ) ); } // Content. writer.print(">"); writer.print( Util.substituteEntitiesInElementContent( form ) ); }
@Override public boolean hasWellFormedXML() throws ReadDeniedException, AuthenticationRequiredException { checkRead(); checkRead(holder.getBaseItem().asTriple()); return holder.getBaseItem().getLiteral().isWellFormedXML(); }
private boolean wPropertyEltLiteral(WType wt, Property prop, Statement s, RDFNode r) { if (prettyWriter.sParseTypeLiteralPropertyElt) return false; if (!((r instanceof Literal) && ((Literal) r).isWellFormedXML())) { return false; } // print out. done(s); tab(); print("<"); wt.wTypeStart(prop); wIdAttrReified(s); maybeNewline(); wParseLiteral(); maybeNewline(); print(">"); print(((Literal) r).getLexicalForm()); print("</"); wt.wTypeEnd(prop); print(">"); return true; }
private boolean wPropertyEltLiteral(WType wt, Property prop, Statement s, RDFNode r) { if (prettyWriter.sParseTypeLiteralPropertyElt) return false; if (!((r instanceof Literal) && ((Literal) r).isWellFormedXML())) { return false; } // print out. done(s); tab(); print("<"); wt.wTypeStart(prop); wIdAttrReified(s); maybeNewline(); wParseLiteral(); maybeNewline(); print(">"); print(((Literal) r).getLexicalForm()); print("</"); wt.wTypeEnd(prop); print(">"); return true; }
} catch (DatatypeFormatException e) {} assertEquals("Extract value", l1.getValue(), new BaseDatatype.TypedValue("foo", typeURI)); assertEquals("Extract xml tag", l1.isWellFormedXML(), false);
} catch (DatatypeFormatException e) {} assertEquals("Extract value", l1.getValue(), new BaseDatatype.TypedValue("foo", typeURI)); assertEquals("Extract xml tag", l1.isWellFormedXML(), false);
/** * Tests the base functioning of a user defined datatype */ public void testUserDef() { // Register the user defined type for rationals RDFDatatype rtype = RationalType.theRationalType; TypeMapper.getInstance().registerDatatype(rtype); Literal l1 = m.createTypedLiteral("3/5", rtype); Literal l3 = m.createTypedLiteral("7/5", rtype); // Check for successful creation assertNotNull(l1); assertNotNull(l3); // check equality function assertDiffer("values should be tested!", l1, l3); // Check typed accessors assertSame("Datatype incorrect", l1.getDatatype(), rtype); assertEquals("Datatype uri incorrect", l1.getDatatypeURI(), RationalType.theTypeURI); Object val = l1.getValue(); assertTrue("Value space check", val instanceof Rational); assertTrue("Value check", ((Rational)val).getNumerator() == 3); assertTrue("Value check", ((Rational)val).getDenominator() == 5); try { l1.getInt(); assertTrue("Allowed int conversion", false); } catch (DatatypeFormatException e) {} assertEquals("Extract xml tag", l1.isWellFormedXML(), false); }
/** * Tests the base functioning of a user defined datatype */ public void testUserDef() { // Register the user defined type for rationals RDFDatatype rtype = RationalType.theRationalType; TypeMapper.getInstance().registerDatatype(rtype); Literal l1 = m.createTypedLiteral("3/5", rtype); Literal l3 = m.createTypedLiteral("7/5", rtype); // Check for successful creation assertNotNull(l1); assertNotNull(l3); // check equality function assertDiffer("values should be tested!", l1, l3); // Check typed accessors assertSame("Datatype incorrect", l1.getDatatype(), rtype); assertEquals("Datatype uri incorrect", l1.getDatatypeURI(), RationalType.theTypeURI); Object val = l1.getValue(); assertTrue("Value space check", val instanceof Rational); assertTrue("Value check", ((Rational)val).getNumerator() == 3); assertTrue("Value check", ((Rational)val).getDenominator() == 5); try { l1.getInt(); assertTrue("Allowed int conversion", false); } catch (DatatypeFormatException e) {} assertEquals("Extract xml tag", l1.isWellFormedXML(), false); }