Repository: Wikidata/Wikidata-Toolkit (java)

Issue:
Remove datatype IRI from Wikibase data model implementation
Datatype IRIs are not native to the Wikibase Data Model. They crease a lot of problems like #716.

We might replace the  `DatatypeIdValue` IRI field with a new field storing the JSON datatype ID.

The IRI support would be moved to the RDF module and stay there.

Migration path:
1. Merge #717
2. Deprecate the IRI field of the DatatypeIdValue
3. After one or two release, drop the IRI field.
4. Migration done!

Pull request:
Deprecate DatatypeIdValue::getIri()
Closes #718.

Patch:
diff --git a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java
index 54b03958..354658fe 100644
--- a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java
+++ b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java
@@ -267,11 +267,26 @@ public class Datamodel {
 	 * @param id
 	 *            the IRI string that identifies the datatype
 	 * @return a {@link DatatypeIdValue} corresponding to the input
+	 * @deprecated use {@link #makeDatatypeIdValueFromJsonString(String)}
 	 */
 	public static DatatypeIdValue makeDatatypeIdValue(String id) {
 		return factory.getDatatypeIdValue(id);
 	}
 
+	/**
+	 * Creates a {@link DatatypeIdValue}. The string is an identifier used in
+	 * the JSON serialization of properties to identify the datatype, and is one
+	 * of the constants defined in {@link DatatypeIdValue}, but this is not enforced,
+	 * since there are extensions that provide additional types.
+	 *
+	 * @param jsonString
+	 *            the string that identifies the datatype
+	 * @return a {@link DatatypeIdValue} corresponding to the input
+	 */
+	public static DatatypeIdValue makeDatatypeIdValueFromJsonString(String jsonString) {
+		return factory.getDatatypeIdValueFromJsonId(jsonString);
+	}
+
 	/**
 	 * Creates a {@link TimeValue}.
 	 *
diff --git a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/DatamodelConverter.java b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/DatamodelConverter.java
index caeca8e8..0486db35 100644
--- a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/DatamodelConverter.java
+++ b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/DatamodelConverter.java
@@ -170,7 +170,7 @@ public class DatamodelConverter implements SnakVisitor<Snak>,
 	 * @return copied object
 	 */
 	public DatatypeIdValue copy(DatatypeIdValue object) {
-		return dataObjectFactory.getDatatypeIdValue(object.getIri());
+		return dataObjectFactory.getDatatypeIdValueFromJsonId(object.getJsonString());
 	}
 
 	/**
diff --git a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/PropertyDocumentBuilder.java b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/PropertyDocumentBuilder.java
index 9bb25039..ff1173d6 100644
--- a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/PropertyDocumentBuilder.java
+++ b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/PropertyDocumentBuilder.java
@@ -99,12 +99,29 @@ public class PropertyDocumentBuilder extends
 	 *            the datatype id of the newly constructed property document,
 	 *            e.g., {@link DatatypeIdValue#DT_ITEM}.
 	 * @return builder object to continue construction
+	 * @deprecated use {@link #forPropertyIdAndJsonDatatype(PropertyIdValue, String)}
 	 */
 	public static PropertyDocumentBuilder forPropertyIdAndDatatype(
 			PropertyIdValue propertyIdValue, String datatypeId) {
 		return forPropertyIdAndDatatype(propertyIdValue,
 				factory.getDatatypeIdValue(datatypeId));
 	}
+
+	/**
+	 * Starts the construction of an {@link PropertyDocument} with the given id.
+	 *
+	 * @param propertyIdValue
+	 *            id of the newly constructed property document
+	 * @param datatypeId
+	 *            the datatype id of the newly constructed property document,
+	 *            e.g., {@link DatatypeIdValue#DT_ITEM}.
+	 * @return builder object to continue construction
+	 */
+	public static PropertyDocumentBuilder forPropertyIdAndJsonDatatype(
+			PropertyIdValue propertyIdValue, String datatypeId) {
+		return forPropertyIdAndDatatype(propertyIdValue,
+				factory.getDatatypeIdValueFromJsonId(datatypeId));
+	}
 	
 	/**
 	 * Changes the entity value id for the constructed document.
diff --git a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/DataObjectFactoryImpl.java b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/DataObjectFactoryImpl.java
index 77fc28fd..877aa1e5 100644
--- a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/DataObjectFactoryImpl.java
+++ b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/DataObjectFactoryImpl.java
@@ -113,8 +113,8 @@ public class DataObjectFactoryImpl implements DataObjectFactory {
 	}
 
 	@Override
-	public DatatypeIdValue getDatatypeIdValue(String id, String jsonString) {
-		return new DatatypeIdImpl(id, jsonString);
+	public DatatypeIdValue getDatatypeIdValueFromJsonId(String jsonId) {
+		return new DatatypeIdImpl(null, jsonId);
 	}
 
 	@Override
diff --git a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/DatatypeIdImpl.java b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/DatatypeIdImpl.java
index 6887af5d..3791f535 100644
--- a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/DatatypeIdImpl.java
+++ b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/DatatypeIdImpl.java
@@ -155,9 +155,6 @@ public class DatatypeIdImpl implements DatatypeIdValue {
 		case JSON_DT_EDTF:
 			return DT_EDTF;
 		default:
-			if(!JSON_DATATYPE_PATTERN.matcher(jsonDatatype).matches()) {
-				throw new IllegalArgumentException("Invalid JSON datatype \"" + jsonDatatype + "\"");
-			}
 
 			String[] parts = jsonDatatype.split("-");
 			for(int i = 0; i < parts.length; i++) {
@@ -175,6 +172,7 @@ public class DatatypeIdImpl implements DatatypeIdValue {
 	 *            the WDTK datatype IRI string; case-sensitive
 	 * @throws IllegalArgumentException
 	 *             if the given datatype string is not known
+	 * @deprecated this method is unreliable and will be removed in a future release.
 	 */
 	public static String getJsonDatatypeFromDatatypeIri(String datatypeIri) {
 		switch (datatypeIri) {
@@ -238,6 +236,7 @@ public class DatatypeIdImpl implements DatatypeIdValue {
 	 * @throws IllegalArgumentException
 	 *             if the given datatype string could not be matched to a known
 	 *             datatype or was null
+	 * @deprecated use {@link #DatatypeIdImpl(String, String)}
 	 */
 	public DatatypeIdImpl(String iri)
 			throws IllegalArgumentException {
@@ -254,17 +253,21 @@ public class DatatypeIdImpl implements DatatypeIdValue {
 	 * is meant to be used for JSON deserialization.
 	 *
 	 * @param iri
-	 *             the WDTK IRI for the datatype
+	 *             the WDTK IRI for the datatype. This can be null.
+	 * @param jsonString
+	 *             the JSON representation of the datatype. This cannot be null.
 	 * @throws IllegalArgumentException
 	 *             if the given datatype string could not be matched to a known
 	 *             datatype or was null
 	 */
 	public DatatypeIdImpl(String iri, String jsonString)
 			throws IllegalArgumentException {
-		Validate.notNull(iri, "An IRI must be provided to create a DatatypeIdValue");
-		this.iri = iri;
 		Validate.notNull(jsonString, "A JSON representation of the datatype must be provided to create a DatatypeIdValue");
+		if(!JSON_DATATYPE_PATTERN.matcher(jsonString).matches()) {
+			throw new IllegalArgumentException("Invalid JSON datatype \"" + jsonString + "\"");
+		}
 		this.jsonString = jsonString;
+		this.iri = iri != null ? iri : getDatatypeIriFromJsonDatatype(jsonString);
 	}
 	
 	/**
diff --git a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/interfaces/DataObjectFactory.java b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/interfaces/DataObjectFactory.java
index b5dabb14..2ebd6bf2 100644
--- a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/interfaces/DataObjectFactory.java
+++ b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/interfaces/DataObjectFactory.java
@@ -138,6 +138,7 @@ public interface DataObjectFactory {
 	 * @param id
 	 *            the IRI string that identifies the datatype
 	 * @return a {@link DatatypeIdValue} corresponding to the input
+	 * @deprecated use {@link #getDatatypeIdValueFromJsonId(String)}
 	 */
 	DatatypeIdValue getDatatypeIdValue(String id);
 
@@ -147,13 +148,11 @@ public interface DataObjectFactory {
 	 * since there might be extensions that provide additional types. The JSON
 	 * string is its representation in the JSON serialization of properties.
 	 *
-	 * @param id
-	 *            the IRI string that identifies the datatype
-	 * @param jsonString
-	 * 			  the JSON representation of this datatype
+	 * @param jsonId
+	 * 			  the JSON representation of this datatype, which cannot be null
 	 * @return a {@link DatatypeIdValue} corresponding to the input
 	 */
-	DatatypeIdValue getDatatypeIdValue(String id, String jsonString);
+	DatatypeIdValue getDatatypeIdValueFromJsonId(String jsonId);
 
 	/**
 	 * Creates a {@link TimeValue}.
diff --git a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/interfaces/DatatypeIdValue.java b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/interfaces/DatatypeIdValue.java
index d03420cd..e29a3f67 100644
--- a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/interfaces/DatatypeIdValue.java
+++ b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/interfaces/DatatypeIdValue.java
@@ -31,81 +31,153 @@ package org.wikidata.wdtk.datamodel.interfaces;
 public interface DatatypeIdValue {
 	/**
 	 * IRI of the item datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_ITEM
 	 */
 	String DT_ITEM = "http://wikiba.se/ontology#WikibaseItem";
 	/**
 	 * IRI of the property datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_PROPERTY
 	 */
 	String DT_PROPERTY = "http://wikiba.se/ontology#WikibaseProperty";
 	/**
 	 * IRI of the lexeme datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_LEXEME
 	 */
 	String DT_LEXEME = "http://wikiba.se/ontology#WikibaseLexeme";
 	/**
 	 * IRI of the form datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_FORM
 	 */
 	String DT_FORM = "http://wikiba.se/ontology#WikibaseForm";
 	/**
 	 * IRI of the sense datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_SENSE
 	 */
 	String DT_SENSE = "http://wikiba.se/ontology#WikibaseSense";
 	/**
 	 * IRI of the media info datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_MEDIA_INFO
 	 */
 	String DT_MEDIA_INFO = "http://wikiba.se/ontology#WikibaseMediaInfo";
 	/**
 	 * IRI of the string datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_STRING
 	 */
 	String DT_STRING = "http://wikiba.se/ontology#String";
 	/**
 	 * IRI of the URL datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_URL
 	 */
 	String DT_URL = "http://wikiba.se/ontology#Url";
 	/**
 	 * IRI of the Commons media datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_COMMONS_MEDIA
 	 */
 	String DT_COMMONS_MEDIA = "http://wikiba.se/ontology#CommonsMedia";
 	/**
 	 * IRI of the time datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_TIME
 	 */
 	String DT_TIME = "http://wikiba.se/ontology#Time";
 	/**
 	 * IRI of the globe coordinates datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_GLOBE_COORDINATES
 	 */
 	String DT_GLOBE_COORDINATES = "http://wikiba.se/ontology#GlobeCoordinate";
 	/**
 	 * IRI of the quantity datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_QUANTITY
 	 */
 	String DT_QUANTITY = "http://wikiba.se/ontology#Quantity";
 	/**
 	 * IRI of the monolingual text datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_MONOLINGUAL_TEXT
 	 */
 	String DT_MONOLINGUAL_TEXT = "http://wikiba.se/ontology#Monolingualtext";
 	/**
 	 * IRI of the external identifier datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_EXTERNAL_ID
 	 */
 	String DT_EXTERNAL_ID = "http://wikiba.se/ontology#ExternalId";
 	/**
 	 * IRI of the math datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_MATH
 	 */
 	String DT_MATH = "http://wikiba.se/ontology#Math";
 	/**
 	 * IRI of the geo shape datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_GEO_SHAPE
 	 */
 	String DT_GEO_SHAPE = "http://wikiba.se/ontology#GeoShape";
 	/**
 	 * IRI of the tabular data datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_TABULAR_DATA
 	 */
 	String DT_TABULAR_DATA = "http://wikiba.se/ontology#TabularData";
 	/**
 	 * IRI of the extended date time format (EDTF) datatype in Wikibase.
+	 * @deprecated use org.wikidata.wdtk.rdf.Vocabulary.DT_EDTF
 	 */
 	String DT_EDTF = "http://wikiba.se/ontology#Edtf";
 
+	/**
+	 * String used to refer to the property datatype for Wikibase items, in JSON.
+	 */
+	String JSON_DT_ITEM = "wikibase-item";
+	/**
+	 * String used to refer to the property datatype for Wikibase properties, in JSON.
+	 */
+	String JSON_DT_PROPERTY = "wikibase-property";
+	/**
+	 * String used to refer to the property datatype for globe coordinates, in JSON.
+	 */
+	String JSON_DT_GLOBE_COORDINATES = "globe-coordinate";
+	/**
+	 * String used to refer to the property datatype for urls, in JSON.
+	 */
+	String JSON_DT_URL = "url";
+	/**
+	 * String used to refer to the property datatype for Commons media files, in JSON.
+	 */
+	String JSON_DT_COMMONS_MEDIA = "commonsMedia";
+	/**
+	 * String used to refer to the property datatype for time values, in JSON.
+	 */
+	String JSON_DT_TIME = "time";
+	/**
+	 * String used to refer to the property datatype for quantities, in JSON.
+	 */
+	String JSON_DT_QUANTITY = "quantity";
+	/**
+	 * String used to refer to the property datatype for strings, in JSON.
+	 */
+	String JSON_DT_STRING = "string";
+	/**
+	 * String used to refer to the property datatype for monolingual text, in JSON.
+	 */
+	String JSON_DT_MONOLINGUAL_TEXT = "monolingualtext";
+	/**
+	 * String used to refer to the property datatype for external identifiers, in JSON.
+	 */
+	String JSON_DT_EXTERNAL_ID = "external-id";
+	/**
+	 * String used to refer to the property datatype for mathematical expressions, in JSON.
+	 */
+	String JSON_DT_MATH = "math";
+	/**
+	 * String used to refer to the property datatype for Geo shapes, in JSON.
+	 */
+	String JSON_DT_GEO_SHAPE = "geo-shape";
+	/**
+	 * String used to refer to the property datatype for EDTF dates, in JSON.
+	 */
+	String JSON_DT_EDTF = "edtf";
+
 	/**
 	 * Get the IRI of this entity.
 	 * 
 	 * @return String with the IRI
+	 * @deprecated use org.wikidata.wdtk.rdf.AbstractRdfConverter.getDatatypeIri() from the wdtk-rdf module
 	 */
 	String getIri();
 
diff --git a/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java b/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java
index 31a2d2c7..e139c5ef 100644
--- a/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java
+++ b/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java
@@ -752,31 +752,31 @@ public class ClassPropertyUsageAnalyzer implements EntityDocumentProcessor {
 			return "Unknown";
 		}
 
-		switch (datatype.getIri()) {
-		case DatatypeIdValue.DT_COMMONS_MEDIA:
+		switch (datatype.getJsonString()) {
+		case DatatypeIdValue.JSON_DT_COMMONS_MEDIA:
 			return "Commons media";
-		case DatatypeIdValue.DT_GLOBE_COORDINATES:
+		case DatatypeIdValue.JSON_DT_GLOBE_COORDINATES:
 			return "Globe coordinates";
-		case DatatypeIdValue.DT_ITEM:
+		case DatatypeIdValue.JSON_DT_ITEM:
 			return "Item";
-		case DatatypeIdValue.DT_QUANTITY:
+		case DatatypeIdValue.JSON_DT_QUANTITY:
 			return "Quantity";
-		case DatatypeIdValue.DT_STRING:
+		case DatatypeIdValue.JSON_DT_STRING:
 			return "String";
-		case DatatypeIdValue.DT_TIME:
+		case DatatypeIdValue.JSON_DT_TIME:
 			return "Time";
-		case DatatypeIdValue.DT_URL:
+		case DatatypeIdValue.JSON_DT_URL:
 			return "URL";
-		case DatatypeIdValue.DT_PROPERTY:
+		case DatatypeIdValue.JSON_DT_PROPERTY:
 			return "Property";
-		case DatatypeIdValue.DT_EXTERNAL_ID:
+		case DatatypeIdValue.JSON_DT_EXTERNAL_ID:
 			return "External identifier";
-		case DatatypeIdValue.DT_MATH:
+		case DatatypeIdValue.JSON_DT_MATH:
 			return "Math";
-		case DatatypeIdValue.DT_MONOLINGUAL_TEXT:
+		case DatatypeIdValue.JSON_DT_MONOLINGUAL_TEXT:
 			return "Monolingual Text";
 		default:
-			throw new RuntimeException("Unknown datatype " + datatype.getIri());
+			throw new RuntimeException("Unknown datatype " + datatype.getJsonString());
 		}
 	}
 
diff --git a/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EditOnlineDataExample.java b/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EditOnlineDataExample.java
index a2ffc77b..72811fc2 100644
--- a/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EditOnlineDataExample.java
+++ b/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EditOnlineDataExample.java
@@ -249,7 +249,7 @@ public class EditOnlineDataExample {
 					.getEntityDocuments(fetchProperties);
 			for (EntityDocument ed : results.values()) {
 				PropertyDocument pd = (PropertyDocument) ed;
-				if (DatatypeIdValue.DT_STRING.equals(pd.getDatatype().getIri())
+				if (DatatypeIdValue.JSON_DT_STRING.equals(pd.getDatatype().getJsonString())
 						&& pd.getLabels().containsKey("en")) {
 					stringProperties.add(pd.getEntityId());
 					System.out.println("* Found string property "
diff --git a/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/AbstractRdfConverter.java b/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/AbstractRdfConverter.java
index adb720e2..542ec888 100644
--- a/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/AbstractRdfConverter.java
+++ b/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/AbstractRdfConverter.java
@@ -24,12 +24,14 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.lang3.StringUtils;
 import org.eclipse.rdf4j.model.Resource;
 import org.eclipse.rdf4j.model.IRI;
 import org.eclipse.rdf4j.model.Value;
 import org.eclipse.rdf4j.rio.RDFHandlerException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.wikidata.wdtk.datamodel.implementation.DatatypeIdImpl;
 import org.wikidata.wdtk.datamodel.interfaces.*;
 import org.wikidata.wdtk.rdf.values.AnyValueConverter;
 
@@ -150,14 +152,14 @@ abstract public class AbstractRdfConverter {
 		this.rdfWriter.writeTripleValueObject(
 				this.rdfWriter.getUri(document.getEntityId().getIri()),
 				RdfWriter.WB_PROPERTY_TYPE,
-				this.rdfWriter.getUri(document.getDatatype().getIri()));
+				this.rdfWriter.getUri(getDatatypeIri(document.getDatatype())));
 	}
 
 	public void writePropertyDocument(PropertyDocument document)
 			throws RDFHandlerException {
 
-		propertyRegister.setPropertyType(document.getEntityId(), document
-				.getDatatype().getIri());
+		propertyRegister.setPropertyType(document.getEntityId(), getDatatypeIri(document
+				.getDatatype()));
 
 		final String subjectUri = document.getEntityId().getIri();
 		final Resource subject = this.rdfWriter.getUri(subjectUri);
@@ -417,4 +419,36 @@ abstract public class AbstractRdfConverter {
 		}
 		return rdfWriter.getLiteral(value.getText(), languageCode);
 	}
+
+	public static String getDatatypeIri(DatatypeIdValue datatype) {
+		String jsonDatatype = datatype.getJsonString();
+		switch (jsonDatatype) {
+			case DatatypeIdValue.JSON_DT_ITEM:
+				return Vocabulary.DT_ITEM;
+			case DatatypeIdValue.JSON_DT_PROPERTY:
+				return Vocabulary.DT_PROPERTY;
+			case DatatypeIdValue.JSON_DT_GLOBE_COORDINATES:
+				return Vocabulary.DT_GLOBE_COORDINATES;
+			case DatatypeIdValue.JSON_DT_URL:
+				return Vocabulary.DT_URL;
+			case DatatypeIdValue.JSON_DT_COMMONS_MEDIA:
+				return Vocabulary.DT_COMMONS_MEDIA;
+			case DatatypeIdValue.JSON_DT_TIME:
+				return Vocabulary.DT_TIME;
+			case DatatypeIdValue.JSON_DT_QUANTITY:
+				return Vocabulary.DT_QUANTITY;
+			case DatatypeIdValue.JSON_DT_STRING:
+				return Vocabulary.DT_STRING;
+			case DatatypeIdValue.JSON_DT_MONOLINGUAL_TEXT:
+				return Vocabulary.DT_MONOLINGUAL_TEXT;
+			case DatatypeIdValue.JSON_DT_EDTF:
+				return Vocabulary.DT_EDTF;
+			default:
+				String[] parts = jsonDatatype.split("-");
+				for(int i = 0; i < parts.length; i++) {
+					parts[i] = StringUtils.capitalize(parts[i]);
+				}
+				return "http://wikiba.se/ontology#" + StringUtils.join(parts);
+		}
+	}
 }
diff --git a/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/PropertyRegister.java b/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/PropertyRegister.java
index 2b7b016e..31cc3d42 100644
--- a/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/PropertyRegister.java
+++ b/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/PropertyRegister.java
@@ -348,8 +348,8 @@ public class PropertyRegister {
 				continue;
 			}
 
-			String datatype = ((PropertyDocument) propertyDocument)
-					.getDatatype().getIri();
+			String datatype = AbstractRdfConverter.getDatatypeIri(((PropertyDocument) propertyDocument)
+					.getDatatype());
 			this.datatypes.put(entry.getKey(), datatype);
 			logger.info("Fetched type information for property "
 					+ entry.getKey() + " online: " + datatype);
diff --git a/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/Vocabulary.java b/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/Vocabulary.java
index 0bc3f3a2..d929cee2 100644
--- a/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/Vocabulary.java
+++ b/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/Vocabulary.java
@@ -112,6 +112,28 @@ public class Vocabulary {
 	public static final String XSD_STRING = PREFIX_XSD + "string";
 	public static final String OGC_LOCATION = PREFIX_GEO + "wktLiteral";
 
+	/*
+	 * IRIs of property datatypes
+	 */
+	public static final String DT_ITEM = PREFIX_WBONTO + "WikibaseItem";
+	public static final String DT_PROPERTY = PREFIX_WBONTO + "WikibaseProperty";
+	public static final String DT_LEXEME = PREFIX_WBONTO + "WikibaseLexeme";
+	public static final String DT_FORM = PREFIX_WBONTO + "WikibaseForm";
+	public static final String DT_SENSE = PREFIX_WBONTO + "WikibaseSense";
+	public static final String DT_MEDIA_INFO = PREFIX_WBONTO + "WikibaseMediaInfo";
+	public static final String DT_STRING = PREFIX_WBONTO + "String";
+	public static final String DT_URL = PREFIX_WBONTO + "Url";
+	public static final String DT_COMMONS_MEDIA = PREFIX_WBONTO + "CommonsMedia";
+	public static final String DT_TIME = PREFIX_WBONTO + "Time";
+	public static final String DT_GLOBE_COORDINATES = PREFIX_WBONTO + "GlobeCoordinate";
+	public static final String DT_QUANTITY = PREFIX_WBONTO + "Quantity";
+	public static final String DT_MONOLINGUAL_TEXT = PREFIX_WBONTO + "Monolingualtext";
+	public static final String DT_EXTERNAL_ID = PREFIX_WBONTO + "ExternalId";
+	public static final String DT_MATH = PREFIX_WBONTO + "Math";
+	public static final String DT_GEO_SHAPE = PREFIX_WBONTO + "GeoShape";
+	public static final String DT_TABULAR_DATA = PREFIX_WBONTO + "TabularData";
+	public static final String DT_EDTF = PREFIX_WBONTO + "Edtf";
+
 	/**
 	 * Hash map defining the OWL declaration types of the standard vocabulary.
 	 * Declaring this explicitly is useful to obtain a self-contained RDF file,


Test patch:
diff --git a/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/helpers/DatamodelTest.java b/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/helpers/DatamodelTest.java
index 2783f7d0..57d25faa 100644
--- a/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/helpers/DatamodelTest.java
+++ b/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/helpers/DatamodelTest.java
@@ -155,9 +155,9 @@ public class DatamodelTest {
 	@Test
 	public final void testGetDatatypeId() {
 		DatatypeIdValue o1 = Datamodel
-				.makeDatatypeIdValue(DatatypeIdValue.DT_TIME);
+				.makeDatatypeIdValueFromJsonString(DatatypeIdValue.JSON_DT_TIME);
 		DatatypeIdValue o2 = factory
-				.getDatatypeIdValue(DatatypeIdValue.DT_TIME);
+				.getDatatypeIdValueFromJsonId(DatatypeIdValue.JSON_DT_TIME);
 		assertEquals(o1, o2);
 	}
 
@@ -383,14 +383,14 @@ public class DatamodelTest {
 	public final void testGetPropertyDocument() {
 		PropertyDocument o1 = Datamodel.makePropertyDocument(
 				factory.getPropertyIdValue("P42", "foo"),
-				factory.getDatatypeIdValue(DatatypeIdValue.DT_TIME));
+				factory.getDatatypeIdValueFromJsonId(DatatypeIdValue.JSON_DT_TIME));
 		PropertyDocument o2 = factory.getPropertyDocument(
 				factory.getPropertyIdValue("P42", "foo"),
 				Collections.emptyList(),
 				Collections.emptyList(),
 				Collections.emptyList(),
 				Collections.emptyList(),
-				factory.getDatatypeIdValue(DatatypeIdValue.DT_TIME),
+				factory.getDatatypeIdValueFromJsonId(DatatypeIdValue.JSON_DT_TIME),
 				0);
 		assertEquals(o1, o2);
 	}
diff --git a/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/implementation/DataObjectFactoryImplTest.java b/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/implementation/DataObjectFactoryImplTest.java
index e4b2bdb5..e2df8595 100644
--- a/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/implementation/DataObjectFactoryImplTest.java
+++ b/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/implementation/DataObjectFactoryImplTest.java
@@ -76,15 +76,15 @@ public class DataObjectFactoryImplTest {
 
 	@Test
 	public final void testGetDatatypeId() {
-		DatatypeIdValue o1 = new DatatypeIdImpl(DatatypeIdValue.DT_TIME);
-		DatatypeIdValue o2 = factory.getDatatypeIdValue(DatatypeIdValue.DT_TIME);
+		DatatypeIdValue o1 = new DatatypeIdImpl(null, DatatypeIdValue.JSON_DT_TIME);
+		DatatypeIdValue o2 = factory.getDatatypeIdValueFromJsonId(DatatypeIdValue.JSON_DT_TIME);
 		assertEquals(o1, o2);
 	}
 
 	@Test
 	public final void testGetDatatypeIdWithJsonString() {
 		DatatypeIdValue o1 = new DatatypeIdImpl(DatatypeIdValue.DT_STRING, DatatypeIdImpl.JSON_DT_STRING);
-		DatatypeIdValue o2 = factory.getDatatypeIdValue(DatatypeIdValue.DT_STRING, DatatypeIdImpl.JSON_DT_STRING);
+		DatatypeIdValue o2 = factory.getDatatypeIdValueFromJsonId(DatatypeIdImpl.JSON_DT_STRING);
 		assertEquals(o1, o2);
 	}
 
@@ -249,7 +249,7 @@ public class DataObjectFactoryImplTest {
 				Collections.emptyList(),
 				Collections.emptyList(),
 				Collections.emptyList(),
-				factory.getDatatypeIdValue(DatatypeIdValue.DT_TIME),
+				factory.getDatatypeIdValueFromJsonId(DatatypeIdValue.JSON_DT_TIME),
 				0);
 		PropertyDocument o2 = factory.getPropertyDocument(
 				factory.getPropertyIdValue("P42", "foo"),
@@ -257,7 +257,7 @@ public class DataObjectFactoryImplTest {
 				Collections.emptyList(),
 				Collections.emptyList(),
 				Collections.emptyList(),
-				factory.getDatatypeIdValue(DatatypeIdValue.DT_TIME),
+				factory.getDatatypeIdValueFromJsonId(DatatypeIdValue.JSON_DT_TIME),
 				0);
 		assertEquals(o1, o2);
 	}
diff --git a/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/implementation/DatatypeIdImplTest.java b/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/implementation/DatatypeIdImplTest.java
index 93636de1..3231d1b7 100644
--- a/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/implementation/DatatypeIdImplTest.java
+++ b/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/implementation/DatatypeIdImplTest.java
@@ -64,183 +64,4 @@ public class DatatypeIdImplTest {
 		assertEquals("http://wikiba.se/ontology#LocalMedia", DatatypeIdImpl.getDatatypeIriFromJsonDatatype("localMedia"));
 	}
 
-	@Test
-	public void testIriForItem() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_ITEM),
-				DatatypeIdValue.DT_ITEM);
-	}
-
-	@Test
-	public void testIriForProperty() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_PROPERTY),
-				DatatypeIdValue.DT_PROPERTY);
-	}
-
-	@Test
-	public void testIriForCoordinate() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_GLOBE_COORDINATES),
-				DatatypeIdValue.DT_GLOBE_COORDINATES);
-	}
-
-	@Test
-	public void testIriForTime() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_TIME),
-				DatatypeIdValue.DT_TIME);
-	}
-
-	@Test
-	public void testIriForString() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_STRING),
-				DatatypeIdValue.DT_STRING);
-	}
-
-	@Test
-	public void testIriForQuantity() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_QUANTITY),
-				DatatypeIdValue.DT_QUANTITY);
-	}
-
-	@Test
-	public void testIriForCommons() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_COMMONS_MEDIA),
-				DatatypeIdValue.DT_COMMONS_MEDIA);
-	}
-
-	@Test
-	public void testIriForExternalId() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_EXTERNAL_ID),
-				DatatypeIdValue.DT_EXTERNAL_ID);
-	}
-
-	@Test
-	public void testIriForMath() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_MATH),
-				DatatypeIdValue.DT_MATH);
-	}
-
-	@Test
-	public void testIriForGeoShape() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_GEO_SHAPE),
-				DatatypeIdValue.DT_GEO_SHAPE);
-	}
-
-	@Test
-	public void testIriForUrl() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_URL),
-				DatatypeIdValue.DT_URL);
-	}
-
-	@Test
-	public void testIriForMonolingualText() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_MONOLINGUAL_TEXT),
-				DatatypeIdValue.DT_MONOLINGUAL_TEXT);
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void testIriForInvalidType() {
-		DatatypeIdImpl.getDatatypeIriFromJsonDatatype("some wrong type");
-	}
-
-	@Test
-	public void testJsonForItem() {
-		assertEquals(
-				DatatypeIdImpl.getJsonDatatypeFromDatatypeIri(DatatypeIdImpl.DT_ITEM),
-				DatatypeIdImpl.JSON_DT_ITEM);
-	}
-
-	@Test
-	public void testJsonForProperty() {
-		assertEquals(
-				DatatypeIdImpl.getJsonDatatypeFromDatatypeIri(DatatypeIdImpl.DT_PROPERTY),
-				DatatypeIdImpl.JSON_DT_PROPERTY);
-	}
-
-	@Test
-	public void testJsonForCoordinate() {
-		assertEquals(
-				DatatypeIdImpl.getJsonDatatypeFromDatatypeIri(DatatypeIdImpl.DT_GLOBE_COORDINATES),
-				DatatypeIdImpl.JSON_DT_GLOBE_COORDINATES);
-	}
-
-	@Test
-	public void testJsonForTime() {
-		assertEquals(
-				DatatypeIdImpl.getJsonDatatypeFromDatatypeIri(DatatypeIdImpl.DT_TIME),
-				DatatypeIdImpl.JSON_DT_TIME);
-	}
-
-	@Test
-	public void testJsonForString() {
-		assertEquals(
-				DatatypeIdImpl.getJsonDatatypeFromDatatypeIri(DatatypeIdImpl.DT_STRING),
-				DatatypeIdImpl.JSON_DT_STRING);
-	}
-
-	@Test
-	public void testJsonForQuantity() {
-		assertEquals(
-				DatatypeIdImpl.getJsonDatatypeFromDatatypeIri(DatatypeIdImpl.DT_QUANTITY),
-				DatatypeIdImpl.JSON_DT_QUANTITY);
-	}
-
-	@Test
-	public void testJsonForCommons() {
-		assertEquals(
-				DatatypeIdImpl.getJsonDatatypeFromDatatypeIri(DatatypeIdImpl.DT_COMMONS_MEDIA),
-				DatatypeIdImpl.JSON_DT_COMMONS_MEDIA);
-	}
-
-	@Test
-	public void testJsonForExternalId() {
-		assertEquals(
-				DatatypeIdImpl.getJsonDatatypeFromDatatypeIri(DatatypeIdImpl.DT_EXTERNAL_ID),
-				DatatypeIdImpl.JSON_DT_EXTERNAL_ID);
-	}
-
-	@Test
-	public void testJsonForMath() {
-		assertEquals(
-				DatatypeIdImpl.getJsonDatatypeFromDatatypeIri(DatatypeIdImpl.DT_MATH),
-				DatatypeIdImpl.JSON_DT_MATH);
-	}
-
-	@Test
-	public void testJsonForGeoShape() {
-		assertEquals(
-				DatatypeIdImpl.getJsonDatatypeFromDatatypeIri(DatatypeIdImpl.DT_GEO_SHAPE),
-				DatatypeIdImpl.JSON_DT_GEO_SHAPE);
-	}
-
-	@Test
-	public void testJsonForUrl() {
-		assertEquals(
-				DatatypeIdImpl.getJsonDatatypeFromDatatypeIri(DatatypeIdImpl.DT_URL),
-				DatatypeIdImpl.JSON_DT_URL);
-	}
-
-	@Test
-	public void testJsonForMonolingualText() {
-		assertEquals(
-				DatatypeIdImpl.getJsonDatatypeFromDatatypeIri(DatatypeIdImpl.DT_MONOLINGUAL_TEXT),
-				DatatypeIdImpl.JSON_DT_MONOLINGUAL_TEXT);
-	}
-
-	@Test
-	public void testIriForEdtf() {
-		assertEquals(
-				DatatypeIdImpl.getDatatypeIriFromJsonDatatype(DatatypeIdImpl.JSON_DT_EDTF),
-				DatatypeIdValue.DT_EDTF);
-	}
 }
diff --git a/wdtk-rdf/src/test/java/org/wikidata/wdtk/rdf/AbstractRdfConverterTest.java b/wdtk-rdf/src/test/java/org/wikidata/wdtk/rdf/AbstractRdfConverterTest.java
new file mode 100644
index 00000000..1975924b
--- /dev/null
+++ b/wdtk-rdf/src/test/java/org/wikidata/wdtk/rdf/AbstractRdfConverterTest.java
@@ -0,0 +1,121 @@
+package org.wikidata.wdtk.rdf;
+
+/*-
+ * #%L
+ * Wikidata Toolkit RDF
+ * %%
+ * Copyright (C) 2014 - 2022 Wikidata Toolkit Developers
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import org.junit.Test;
+import org.wikidata.wdtk.datamodel.helpers.Datamodel;
+import org.wikidata.wdtk.datamodel.implementation.DatatypeIdImpl;
+import org.wikidata.wdtk.datamodel.interfaces.DatatypeIdValue;
+
+import static org.junit.Assert.assertEquals;
+
+public class AbstractRdfConverterTest {
+    @Test
+    public void testIriForItem() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_ITEM)),
+                Vocabulary.DT_ITEM);
+    }
+
+    @Test
+    public void testIriForProperty() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_PROPERTY)),
+                Vocabulary.DT_PROPERTY);
+    }
+
+    @Test
+    public void testIriForCoordinate() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_GLOBE_COORDINATES)),
+                Vocabulary.DT_GLOBE_COORDINATES);
+    }
+
+    @Test
+    public void testIriForTime() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_TIME)),
+                Vocabulary.DT_TIME);
+    }
+
+    @Test
+    public void testIriForString() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_STRING)),
+                Vocabulary.DT_STRING);
+    }
+
+    @Test
+    public void testIriForQuantity() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_QUANTITY)),
+                Vocabulary.DT_QUANTITY);
+    }
+
+    @Test
+    public void testIriForCommons() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_COMMONS_MEDIA)),
+                Vocabulary.DT_COMMONS_MEDIA);
+    }
+
+    @Test
+    public void testIriForExternalId() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_EXTERNAL_ID)),
+                Vocabulary.DT_EXTERNAL_ID);
+    }
+
+    @Test
+    public void testIriForMath() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_MATH)),
+                Vocabulary.DT_MATH);
+    }
+
+    @Test
+    public void testIriForGeoShape() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_GEO_SHAPE)),
+                Vocabulary.DT_GEO_SHAPE);
+    }
+
+    @Test
+    public void testIriForUrl() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_URL)),
+                Vocabulary.DT_URL);
+    }
+
+    @Test
+    public void testIriForMonolingualText() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_MONOLINGUAL_TEXT)),
+                Vocabulary.DT_MONOLINGUAL_TEXT);
+    }
+    
+    @Test
+    public void testIriForEdtf() {
+        assertEquals(
+                AbstractRdfConverter.getDatatypeIri(Datamodel.makeDatatypeIdValueFromJsonString(DatatypeIdImpl.JSON_DT_EDTF)),
+                Vocabulary.DT_EDTF);
+    }
+}
diff --git a/wdtk-rdf/src/test/java/org/wikidata/wdtk/rdf/PropertyRegisterTest.java b/wdtk-rdf/src/test/java/org/wikidata/wdtk/rdf/PropertyRegisterTest.java
index a3830a8d..059705a4 100644
--- a/wdtk-rdf/src/test/java/org/wikidata/wdtk/rdf/PropertyRegisterTest.java
+++ b/wdtk-rdf/src/test/java/org/wikidata/wdtk/rdf/PropertyRegisterTest.java
@@ -111,14 +111,14 @@ public class PropertyRegisterTest {
 						Collections.emptyList(), Collections.emptyList(),
 						Collections.emptyList(),
 						mockStatementGroups, dataObjectFactory
-								.getDatatypeIdValue(DatatypeIdValue.DT_STRING),
+								.getDatatypeIdValueFromJsonId(DatatypeIdValue.JSON_DT_STRING),
 						0));
 		mockResult.put("P23", dataObjectFactory.getPropertyDocument(pid23,
 				Collections.emptyList(),
 				Collections.emptyList(),
 				Collections.emptyList(),
 				Collections.emptyList(),
-				dataObjectFactory.getDatatypeIdValue(DatatypeIdValue.DT_ITEM),
+				dataObjectFactory.getDatatypeIdValueFromJsonId(DatatypeIdValue.JSON_DT_ITEM),
 				0));
 		mockResult.put("P508", dataObjectFactory.getPropertyDocument(pid508,
 				Collections.emptyList(),
@@ -127,7 +127,7 @@ public class PropertyRegisterTest {
 				Collections.singletonList(dataObjectFactory.getStatementGroup(
 						Collections.singletonList(p1921StatementExternalID)
 				)),
-				dataObjectFactory.getDatatypeIdValue(DatatypeIdValue.DT_EXTERNAL_ID),
+				dataObjectFactory.getDatatypeIdValueFromJsonId(DatatypeIdValue.JSON_DT_EXTERNAL_ID),
 				0));
 
 		this.propertyRegister = new PropertyRegister("P1921",