@Test public void testConvertLiteral_nullDataType() { final String expectedData = "Ice Cream"; final RyaType ryaType = new RyaType(null, expectedData); final Literal literal = RyaToRdfConversions.convertLiteral(ryaType); final Literal expected = VF.createLiteral(expectedData, XMLSchema.STRING); assertEquals(expected, literal); assertFalse(literal.getLanguage().isPresent()); }
public static Literal convertLiteral(final RyaType ryaType) { if (XMLSchema.STRING.equals(ryaType.getDataType())) { return VF.createLiteral(ryaType.getData()); } else if (RDF.LANGSTRING.equals(ryaType.getDataType())) { final String data = ryaType.getData(); final String language = ryaType.getLanguage(); if (language != null && Literals.isValidLanguageTag(language)) { return VF.createLiteral(data, language); } else { return VF.createLiteral(data, LiteralLanguageUtils.UNDETERMINED_LANGUAGE); } } return VF.createLiteral(ryaType.getData(), ryaType.getDataType()); }
RyaToRdfConversions { public static Literal convertLiteral(final RyaType ryaType) { if (XMLSchema.STRING.equals(ryaType.getDataType())) { return VF.createLiteral(ryaType.getData()); } else if (RDF.LANGSTRING.equals(ryaType.getDataType())) { final String data = ryaType.getData(); final String language = ryaType.getLanguage(); if (language != null && Literals.isValidLanguageTag(language)) { return VF.createLiteral(data, language); } else { return VF.createLiteral(data, LiteralLanguageUtils.UNDETERMINED_LANGUAGE); } } return VF.createLiteral(ryaType.getData(), ryaType.getDataType()); } }
RyaToRdfConversions { public static Literal convertLiteral(final RyaType ryaType) { if (XMLSchema.STRING.equals(ryaType.getDataType())) { return VF.createLiteral(ryaType.getData()); } else if (RDF.LANGSTRING.equals(ryaType.getDataType())) { final String data = ryaType.getData(); final String language = ryaType.getLanguage(); if (language != null && Literals.isValidLanguageTag(language)) { return VF.createLiteral(data, language); } else { return VF.createLiteral(data, LiteralLanguageUtils.UNDETERMINED_LANGUAGE); } } return VF.createLiteral(ryaType.getData(), ryaType.getDataType()); }  }
RyaToRdfConversions { public static Literal convertLiteral(final RyaType ryaType) { if (XMLSchema.STRING.equals(ryaType.getDataType())) { return VF.createLiteral(ryaType.getData()); } else if (RDF.LANGSTRING.equals(ryaType.getDataType())) { final String data = ryaType.getData(); final String language = ryaType.getLanguage(); if (language != null && Literals.isValidLanguageTag(language)) { return VF.createLiteral(data, language); } else { return VF.createLiteral(data, LiteralLanguageUtils.UNDETERMINED_LANGUAGE); } } return VF.createLiteral(ryaType.getData(), ryaType.getDataType()); }  static IRI convertIRI(final RyaIRI ryaIri); static Literal convertLiteral(final RyaType ryaType); static Value convertValue(final RyaType ryaType); static Statement convertStatement(final RyaStatement ryaStatement); }
RyaToRdfConversions { public static Literal convertLiteral(final RyaType ryaType) { if (XMLSchema.STRING.equals(ryaType.getDataType())) { return VF.createLiteral(ryaType.getData()); } else if (RDF.LANGSTRING.equals(ryaType.getDataType())) { final String data = ryaType.getData(); final String language = ryaType.getLanguage(); if (language != null && Literals.isValidLanguageTag(language)) { return VF.createLiteral(data, language); } else { return VF.createLiteral(data, LiteralLanguageUtils.UNDETERMINED_LANGUAGE); } } return VF.createLiteral(ryaType.getData(), ryaType.getDataType()); }  static IRI convertIRI(final RyaIRI ryaIri); static Literal convertLiteral(final RyaType ryaType); static Value convertValue(final RyaType ryaType); static Statement convertStatement(final RyaStatement ryaStatement);  }