Skip to content
Permalink
Browse files
CLEREZZA-1001: Using rdf:langString datatype where necessary
  • Loading branch information
retog committed Oct 3, 2015
1 parent 6677feb commit 4627115eafa2ec03d668b59701633c29cfb62b4c
Showing 2 changed files with 16 additions and 8 deletions.
@@ -98,6 +98,7 @@ final public static class SparqlsResultsHandler extends DefaultHandler {
private String value;
private Map<String, BlankNode> bNodeMap = new HashMap<>();
private static final IRI XSD_STRING = new IRI("http://www.w3.org/2001/XMLSchema#string");
private static final IRI RDF_LANG_STRING = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");

private RDFTerm getBNode(String value) {
if (!bNodeMap.containsKey(value)) {
@@ -195,6 +196,9 @@ public String getLexicalForm() {

@Override
public IRI getDataType() {
if (language != null) {
return RDF_LANG_STRING;
}
//TODO implement
return XSD_STRING;
}
@@ -30,14 +30,11 @@
*/
public class PlainLiteralImpl extends AbstractLiteral implements Literal, Serializable {

private String lexicalForm;
private Language language = null;
private final String lexicalForm;
private final Language language;

public PlainLiteralImpl(String value) {
if (value == null) {
throw new IllegalArgumentException("The literal string cannot be null");
}
this.lexicalForm = value;
this(value, null);
}

public PlainLiteralImpl(String value, Language language) {
@@ -46,6 +43,11 @@ public PlainLiteralImpl(String value, Language language) {
}
this.lexicalForm = value;
this.language = language;
if (language == null) {
dataType = XSD_STRING;
} else {
dataType = RDF_LANG_STRING;
}
}

@Override
@@ -70,8 +72,10 @@ public String toString() {

@Override
public IRI getDataType() {
return XSD_STRING;
return dataType;
}
private final IRI dataType;
private static final IRI XSD_STRING = new IRI("http://www.w3.org/2001/XMLSchema#string");
private static final int XSD_STRING_HASH = XSD_STRING.hashCode();
private static final IRI RDF_LANG_STRING = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");
//private static final int XSD_STRING_HASH = dataType.hashCode();
}

0 comments on commit 4627115

Please sign in to comment.