@Test public void testConvertLiteral_undeterminedLanguage() { final String expectedData = "Hello"; final String language = LiteralLanguageUtils.UNDETERMINED_LANGUAGE; assertTrue(Literals.isValidLanguageTag(language)); final RyaType ryaType = new RyaType(RDF.LANGSTRING, expectedData, language); final Literal literal = RyaToRdfConversions.convertLiteral(ryaType); assertEquals(RDF.LANGSTRING, literal.getDatatype()); assertEquals(expectedData, literal.getLabel()); assertTrue(literal.getLanguage().isPresent()); assertEquals(LiteralLanguageUtils.UNDETERMINED_LANGUAGE, literal.getLanguage().get()); final Literal expectedLiteral = VF.createLiteral(expectedData, language); assertEquals(expectedLiteral, literal); }
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);  }