Author: fchrist
Date: Thu Oct 6 20:23:50 2011
New Revision: 1179824
URL: http://svn.apache.org/viewvc?rev=1179824&view=rev
Log:
STANBOL-341 Fix to not use CURIEs in @type
Modified:
incubator/stanbol/trunk/commons/jsonld/src/main/java/org/apache/stanbol/commons/jsonld/JsonLd.java
incubator/stanbol/trunk/commons/jsonld/src/test/java/org/apache/stanbol/commons/jsonld/JsonLdTest.java
incubator/stanbol/trunk/commons/web/base/src/test/java/org/apache/stanbol/commons/web/base/writers/JsonLdSerializerProviderTest.java
Modified:
incubator/stanbol/trunk/commons/jsonld/src/main/java/org/apache/stanbol/commons/jsonld/JsonLd.java
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/jsonld/src/main/java/org/apache/stanbol/commons/jsonld/JsonLd.java?rev=1179824&r1=1179823&r2=1179824&view=diff
==============================================================================
---
incubator/stanbol/trunk/commons/jsonld/src/main/java/org/apache/stanbol/commons/jsonld/JsonLd.java
(original)
+++
incubator/stanbol/trunk/commons/jsonld/src/main/java/org/apache/stanbol/commons/jsonld/JsonLd.java
Thu Oct 6 20:23:50 2011
@@ -274,7 +274,7 @@ public class JsonLd extends JsonLdCommon
if (!resource.getTypes().isEmpty()) {
List<String> types = new ArrayList<String>();
for (String type : resource.getTypes()) {
- types.add(shortenURIWithCuries(type));
+ types.add(shortenURI(type));
}
if (types.size() == 1) {
subjectObject.put(TYPE, types.get(0));
Modified:
incubator/stanbol/trunk/commons/jsonld/src/test/java/org/apache/stanbol/commons/jsonld/JsonLdTest.java
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/jsonld/src/test/java/org/apache/stanbol/commons/jsonld/JsonLdTest.java?rev=1179824&r1=1179823&r2=1179824&view=diff
==============================================================================
---
incubator/stanbol/trunk/commons/jsonld/src/test/java/org/apache/stanbol/commons/jsonld/JsonLdTest.java
(original)
+++
incubator/stanbol/trunk/commons/jsonld/src/test/java/org/apache/stanbol/commons/jsonld/JsonLdTest.java
Thu Oct 6 20:23:50 2011
@@ -80,7 +80,7 @@ public class JsonLdTest {
jsonLd.put(jsonLdResource);
String actual = jsonLd.toString();
- String expected =
"{\"@context\":{\"avatar\":\"http://sioc.org/vocab/1/avatar\",\"credits\":\"http://example.org/myvocab#credits\",\"foaf\":\"http://xmlns.com/foaf/0.1/\",\"homepage\":\"http://xmlns.com/foaf/0.1/homepage\",\"name\":\"http://xmlns.com/foaf/0.1/name\"},\"@type\":\"foaf:Person\",\"avatar\":\"http://twitter.com/account/profile_image/manusporny\",\"credits\":500,\"homepage\":\"http://manu.sporny.org/\",\"name\":\"Manu
Sporny\"}";
+ String expected =
"{\"@context\":{\"avatar\":\"http://sioc.org/vocab/1/avatar\",\"credits\":\"http://example.org/myvocab#credits\",\"homepage\":\"http://xmlns.com/foaf/0.1/homepage\",\"name\":\"http://xmlns.com/foaf/0.1/name\",\"Person\":\"http://xmlns.com/foaf/0.1/Person\"},\"@type\":\"Person\",\"avatar\":\"http://twitter.com/account/profile_image/manusporny\",\"credits\":500,\"homepage\":\"http://manu.sporny.org/\",\"name\":\"Manu
Sporny\"}";
assertEquals(expected, actual);
}
@@ -152,7 +152,7 @@ public class JsonLdTest {
jsonLd.put(r3.getSubject(), r3);
String actual = jsonLd.toString();
- String expected =
"{\"@context\":{\"foaf\":\"http://xmlns.com/foaf/0.1/\",\"homepage\":\"http://xmlns.com/foaf/0.1/homepage\",\"name\":\"http://xmlns.com/foaf/0.1/name\"},\"@subject\":[{\"@subject\":\"_:bnode1\",\"@type\":\"foaf:Person\",\"homepage\":\"<http://example.com/bob>\",\"name\":\"Bob\"},{\"@subject\":\"_:bnode2\",\"@type\":\"foaf:Person\",\"homepage\":\"<http://example.com/eve>\",\"name\":\"Eve\"},{\"@subject\":\"_:bnode3\",\"@type\":\"foaf:Person\",\"homepage\":\"<http://example.com/bert>\",\"name\":\"Bert\"}]}";
+ String expected =
"{\"@context\":{\"homepage\":\"http://xmlns.com/foaf/0.1/homepage\",\"name\":\"http://xmlns.com/foaf/0.1/name\",\"Person\":\"http://xmlns.com/foaf/0.1/Person\"},\"@subject\":[{\"@subject\":\"_:bnode1\",\"@type\":\"Person\",\"homepage\":\"<http://example.com/bob>\",\"name\":\"Bob\"},{\"@subject\":\"_:bnode2\",\"@type\":\"Person\",\"homepage\":\"<http://example.com/eve>\",\"name\":\"Eve\"},{\"@subject\":\"_:bnode3\",\"@type\":\"Person\",\"homepage\":\"<http://example.com/bert>\",\"name\":\"Bert\"}]}";
assertEquals(expected, actual);
}
@@ -224,7 +224,7 @@ public class JsonLdTest {
jsonLd.put(r3.getSubject(), r3);
String actual = jsonLd.toString();
- String expected =
"[{\"@context\":{\"foaf\":\"http://xmlns.com/foaf/0.1/\",\"homepage\":\"http://xmlns.com/foaf/0.1/homepage\",\"name\":\"http://xmlns.com/foaf/0.1/name\"},\"@subject\":\"_:bnode1\",\"@type\":\"foaf:Person\",\"homepage\":\"<http://example.com/bob>\",\"name\":\"Bob\"},{\"@context\":{\"foaf\":\"http://xmlns.com/foaf/0.1/\",\"homepage\":\"http://xmlns.com/foaf/0.1/homepage\",\"name\":\"http://xmlns.com/foaf/0.1/name\"},\"@subject\":\"_:bnode2\",\"@type\":\"foaf:Person\",\"homepage\":\"<http://example.com/eve>\",\"name\":\"Eve\"},{\"@context\":{\"foaf\":\"http://xmlns.com/foaf/0.1/\",\"homepage\":\"http://xmlns.com/foaf/0.1/homepage\",\"name\":\"http://xmlns.com/foaf/0.1/name\"},\"@subject\":\"_:bnode3\",\"@type\":\"foaf:Person\",\"homepage\":\"<http://example.com/eve>\",\"name\":\"Eve\"}]";
+ String expected =
"[{\"@context\":{\"homepage\":\"http://xmlns.com/foaf/0.1/homepage\",\"name\":\"http://xmlns.com/foaf/0.1/name\",\"Person\":\"http://xmlns.com/foaf/0.1/Person\"},\"@subject\":\"_:bnode1\",\"@type\":\"Person\",\"homepage\":\"<http://example.com/bob>\",\"name\":\"Bob\"},{\"@context\":{\"homepage\":\"http://xmlns.com/foaf/0.1/homepage\",\"name\":\"http://xmlns.com/foaf/0.1/name\",\"Person\":\"http://xmlns.com/foaf/0.1/Person\"},\"@subject\":\"_:bnode2\",\"@type\":\"Person\",\"homepage\":\"<http://example.com/eve>\",\"name\":\"Eve\"},{\"@context\":{\"homepage\":\"http://xmlns.com/foaf/0.1/homepage\",\"name\":\"http://xmlns.com/foaf/0.1/name\",\"Person\":\"http://xmlns.com/foaf/0.1/Person\"},\"@subject\":\"_:bnode3\",\"@type\":\"Person\",\"homepage\":\"<http://example.com/eve>\",\"name\":\"Eve\"}]";
assertEquals(expected, actual);
}
@@ -813,7 +813,7 @@ public class JsonLdTest {
jsonLd.put(r1);
String actual = jsonLd.toString();
- String expected =
"{\"@context\":{\"age\":\"http://xmlns.com/foaf/0.1/age\",\"foaf\":\"http://xmlns.com/foaf/0.1/\",\"xsd\":\"http://www.w3.org/2001/XMLSchema#\",\"@coerce\":{\"xsd:float\":\"age\"}},\"@subject\":\"_:bnode1\",\"@type\":[\"foaf:name\",\"xsd:String\"],\"age\":31.533567}";
+ String expected =
"{\"@context\":{\"age\":\"http://xmlns.com/foaf/0.1/age\",\"name\":\"http://xmlns.com/foaf/0.1/name\",\"String\":\"http://www.w3.org/2001/XMLSchema#String\",\"xsd\":\"http://www.w3.org/2001/XMLSchema#\",\"@coerce\":{\"xsd:float\":\"age\"}},\"@subject\":\"_:bnode1\",\"@type\":[\"String\",\"name\"],\"age\":31.533567}";
assertEquals(expected, actual);
}
@@ -834,7 +834,7 @@ public class JsonLdTest {
jsonLd.put(r1);
String actual = jsonLd.toString();
- String expected =
"{\"@context\":{\"age\":\"http://xmlns.com/foaf/0.1/age\",\"foaf\":\"http://xmlns.com/foaf/0.1/\",\"xsd\":\"http://www.w3.org/2001/XMLSchema#\",\"@coerce\":{\"xsd:float\":\"age\"}},\"@subject\":\"_:bnode1\",\"@type\":[\"foaf:String\",\"xsd:String\"],\"age\":31.533567}";
+ String expected =
"{\"@context\":{\"foaf\":\"http://xmlns.com/foaf/0.1/\",\"xsd\":\"http://www.w3.org/2001/XMLSchema#\",\"@coerce\":{\"xsd:float\":\"foaf:age\"}},\"@subject\":\"_:bnode1\",\"@type\":[\"foaf:String\",\"xsd:String\"],\"foaf:age\":31.533567}";
assertEquals(expected, actual);
}
@@ -863,7 +863,7 @@ public class JsonLdTest {
jsonLd.put(r2);
String actual = jsonLd.toString();
- String expected =
"{\"@context\":{\"age\":\"http://xmlns.com/foaf/0.1/age\",\"foaf\":\"http://xmlns.com/foaf/0.1/\",\"xsd\":\"http://www.w3.org/2001/XMLSchema#\",\"@coerce\":{\"xsd:float\":\"age\"}},\"@subject\":[{\"@subject\":\"_:bnode1\",\"@type\":[\"foaf:name\",\"xsd:String\"],\"age\":31.533567},{\"@subject\":\"_:bnode2\",\"@type\":[\"foaf:name\",\"xsd:String\"],\"age\":31.533567}]}";
+ String expected =
"{\"@context\":{\"age\":\"http://xmlns.com/foaf/0.1/age\",\"name\":\"http://xmlns.com/foaf/0.1/name\",\"String\":\"http://www.w3.org/2001/XMLSchema#String\",\"xsd\":\"http://www.w3.org/2001/XMLSchema#\",\"@coerce\":{\"xsd:float\":\"age\"}},\"@subject\":[{\"@subject\":\"_:bnode1\",\"@type\":[\"String\",\"name\"],\"age\":31.533567},{\"@subject\":\"_:bnode2\",\"@type\":[\"String\",\"name\"],\"age\":31.533567}]}";
assertEquals(expected, actual);
}
Modified:
incubator/stanbol/trunk/commons/web/base/src/test/java/org/apache/stanbol/commons/web/base/writers/JsonLdSerializerProviderTest.java
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/base/src/test/java/org/apache/stanbol/commons/web/base/writers/JsonLdSerializerProviderTest.java?rev=1179824&r1=1179823&r2=1179824&view=diff
==============================================================================
---
incubator/stanbol/trunk/commons/web/base/src/test/java/org/apache/stanbol/commons/web/base/writers/JsonLdSerializerProviderTest.java
(original)
+++
incubator/stanbol/trunk/commons/web/base/src/test/java/org/apache/stanbol/commons/web/base/writers/JsonLdSerializerProviderTest.java
Thu Oct 6 20:23:50 2011
@@ -102,7 +102,7 @@ public class JsonLdSerializerProviderTes
jsonldProvider.setUseTypeCoercion(false);
jsonldProvider.serialize(serializedGraph, ci.getMetadata(),
formatIdentifier);
- String expected =
"{\"@context\":{\"created\":\"http://purl.org/dc/terms/created\",\"creator\":\"http://purl.org/dc/terms/creator\",\"dateTime\":\"http://www.w3.org/2001/XMLSchema#dateTime\",\"end\":\"http://fise.iks-project.eu/ontology/end\",\"enhancer\":\"http://fise.iks-project.eu/ontology/\",\"int\":\"http://www.w3.org/2001/XMLSchema#int\",\"selected-text\":\"http://fise.iks-project.eu/ontology/selected-text\",\"selection-context\":\"http://fise.iks-project.eu/ontology/selection-context\",\"start\":\"http://fise.iks-project.eu/ontology/start\",\"string\":\"http://www.w3.org/2001/XMLSchema#string\",\"type\":\"http://purl.org/dc/terms/type\"},\"@subject\":\"urn:iks-project:enhancer:test:text-annotation:Person\",\"@type\":[\"enhancer:Enhancement\",\"enhancer:TextAnnotation\"],\"created\":{\"@literal\":\""+this.expectedW3CFormattedDate+"\",\"@datatype\":\"dateTime\"},\"creator\":{\"@literal\":\"urn:iks-project:enhancer:test:dummyEngine\",\"@datatype\":\"@iri\"},\"end
\":{\"@literal\":\"20\",\"@datatype\":\"int\"},\"selected-text\":{\"@literal\":\"Patrick
Marshall\",\"@datatype\":\"string\"},\"selection-context\":{\"@literal\":\"Dr.
Patrick Marshall (1869 - November 1950) was a geologist who lived in New
Zealand and worked at the University of
Otago.\",\"@datatype\":\"string\"},\"start\":{\"@literal\":\"4\",\"@datatype\":\"int\"},\"type\":{\"@literal\":\"http://dbpedia.org/ontology/Person\",\"@datatype\":\"@iri\"}}";
+ String expected =
"{\"@context\":{\"created\":\"http://purl.org/dc/terms/created\",\"creator\":\"http://purl.org/dc/terms/creator\",\"dateTime\":\"http://www.w3.org/2001/XMLSchema#dateTime\",\"end\":\"http://fise.iks-project.eu/ontology/end\",\"Enhancement\":\"http://fise.iks-project.eu/ontology/Enhancement\",\"int\":\"http://www.w3.org/2001/XMLSchema#int\",\"selected-text\":\"http://fise.iks-project.eu/ontology/selected-text\",\"selection-context\":\"http://fise.iks-project.eu/ontology/selection-context\",\"start\":\"http://fise.iks-project.eu/ontology/start\",\"string\":\"http://www.w3.org/2001/XMLSchema#string\",\"TextAnnotation\":\"http://fise.iks-project.eu/ontology/TextAnnotation\",\"type\":\"http://purl.org/dc/terms/type\"},\"@subject\":\"urn:iks-project:enhancer:test:text-annotation:Person\",\"@type\":[\"Enhancement\",\"TextAnnotation\"],\"created\":{\"@literal\":\""+this.expectedW3CFormattedDate+"\",\"@datatype\":\"dateTime\"},\"creator\":{\"@literal\":\"urn
:iks-project:enhancer:test:dummyEngine\",\"@datatype\":\"@iri\"},\"end\":{\"@literal\":\"20\",\"@datatype\":\"int\"},\"selected-text\":{\"@literal\":\"Patrick
Marshall\",\"@datatype\":\"string\"},\"selection-context\":{\"@literal\":\"Dr.
Patrick Marshall (1869 - November 1950) was a geologist who lived in New
Zealand and worked at the University of
Otago.\",\"@datatype\":\"string\"},\"start\":{\"@literal\":\"4\",\"@datatype\":\"int\"},\"type\":{\"@literal\":\"http://dbpedia.org/ontology/Person\",\"@datatype\":\"@iri\"}}";
String result = serializedGraph.toString();
Assert.assertEquals(expected, result);
}
@@ -119,7 +119,7 @@ public class JsonLdSerializerProviderTes
jsonldProvider.setIndentation(0);
jsonldProvider.serialize(serializedGraph, ci.getMetadata(),
formatIdentifier);
- String expected =
"{\"@context\":{\"created\":\"http://purl.org/dc/terms/created\",\"creator\":\"http://purl.org/dc/terms/creator\",\"end\":\"http://fise.iks-project.eu/ontology/end\",\"enhancer\":\"http://fise.iks-project.eu/ontology/\",\"Person\":\"http://dbpedia.org/ontology/Person\",\"selected-text\":\"http://fise.iks-project.eu/ontology/selected-text\",\"selection-context\":\"http://fise.iks-project.eu/ontology/selection-context\",\"start\":\"http://fise.iks-project.eu/ontology/start\",\"type\":\"http://purl.org/dc/terms/type\",\"xsd\":\"http://www.w3.org/2001/XMLSchema#\",\"@coerce\":{\"@iri\":[\"creator\",\"type\"],\"xsd:dateTime\":\"created\",\"xsd:int\":[\"end\",\"start\"],\"xsd:string\":[\"selected-text\",\"selection-context\"]}},\"@subject\":\"urn:iks-project:enhancer:test:text-annotation:Person\",\"@type\":[\"enhancer:Enhancement\",\"enhancer:TextAnnotation\"],\"created\":\""+this.expectedW3CFormattedDate+"\",\"creator\":\"urn:iks-project:enhancer:test:du
mmyEngine\",\"end\":20,\"selected-text\":\"Patrick
Marshall\",\"selection-context\":\"Dr. Patrick Marshall (1869 - November 1950)
was a geologist who lived in New Zealand and worked at the University of
Otago.\",\"start\":4,\"type\":\"Person\"}";
+ String expected =
"{\"@context\":{\"created\":\"http://purl.org/dc/terms/created\",\"creator\":\"http://purl.org/dc/terms/creator\",\"end\":\"http://fise.iks-project.eu/ontology/end\",\"Enhancement\":\"http://fise.iks-project.eu/ontology/Enhancement\",\"Person\":\"http://dbpedia.org/ontology/Person\",\"selected-text\":\"http://fise.iks-project.eu/ontology/selected-text\",\"selection-context\":\"http://fise.iks-project.eu/ontology/selection-context\",\"start\":\"http://fise.iks-project.eu/ontology/start\",\"TextAnnotation\":\"http://fise.iks-project.eu/ontology/TextAnnotation\",\"type\":\"http://purl.org/dc/terms/type\",\"xsd\":\"http://www.w3.org/2001/XMLSchema#\",\"@coerce\":{\"@iri\":[\"creator\",\"type\"],\"xsd:dateTime\":\"created\",\"xsd:int\":[\"end\",\"start\"],\"xsd:string\":[\"selected-text\",\"selection-context\"]}},\"@subject\":\"urn:iks-project:enhancer:test:text-annotation:Person\",\"@type\":[\"Enhancement\",\"TextAnnotation\"],\"created\":\""+this.expec
tedW3CFormattedDate+"\",\"creator\":\"urn:iks-project:enhancer:test:dummyEngine\",\"end\":20,\"selected-text\":\"Patrick
Marshall\",\"selection-context\":\"Dr. Patrick Marshall (1869 - November 1950)
was a geologist who lived in New Zealand and worked at the University of
Otago.\",\"start\":4,\"type\":\"Person\"}";
String result = serializedGraph.toString();
Assert.assertEquals(expected, result);
}
@@ -135,7 +135,7 @@ public class JsonLdSerializerProviderTes
jsonldProvider.setUseTypeCoercion(false);
jsonldProvider.serialize(serializedGraph, ci.getMetadata(),
formatIdentifier);
- String expected = "{\n \"@context\": {\n \"created\":
\"http://purl.org/dc/terms/created\",\n \"creator\":
\"http://purl.org/dc/terms/creator\",\n \"dateTime\":
\"http://www.w3.org/2001/XMLSchema#dateTime\",\n \"end\":
\"http://fise.iks-project.eu/ontology/end\",\n \"enhancer\":
\"http://fise.iks-project.eu/ontology/\",\n \"int\":
\"http://www.w3.org/2001/XMLSchema#int\",\n \"selected-text\":
\"http://fise.iks-project.eu/ontology/selected-text\",\n
\"selection-context\":
\"http://fise.iks-project.eu/ontology/selection-context\",\n \"start\":
\"http://fise.iks-project.eu/ontology/start\",\n \"string\":
\"http://www.w3.org/2001/XMLSchema#string\",\n \"type\":
\"http://purl.org/dc/terms/type\"\n },\n \"@subject\":
\"urn:iks-project:enhancer:test:text-annotation:Person\",\n \"@type\": [\n
\"enhancer:Enhancement\",\n \"enhancer:TextAnnotation\"\n ],\n
\"created\": {\n \"@literal\": \""+this.expectedW3CFormattedDate+"\",\n
\"@datatype\": \"dateTime\"\n },\n \"creator\": {\n \"@literal\":
\"urn:iks-project:enhancer:test:dummyEngine\",\n \"@datatype\": \"@iri\"\n
},\n \"end\": {\n \"@literal\": \"20\",\n \"@datatype\": \"int\"\n },\n
\"selected-text\": {\n \"@literal\": \"Patrick Marshall\",\n
\"@datatype\": \"string\"\n },\n \"selection-context\": {\n \"@literal\":
\"Dr. Patrick Marshall (1869 - November 1950) was a geologist who lived in New
Zealand and worked at the University of Otago.\",\n \"@datatype\":
\"string\"\n },\n \"start\": {\n \"@literal\": \"4\",\n \"@datatype\":
\"int\"\n },\n \"type\": {\n \"@literal\":
\"http://dbpedia.org/ontology/Person\",\n \"@datatype\": \"@iri\"\n }\n}";
+ String expected = "{\n \"@context\": {\n \"created\":
\"http://purl.org/dc/terms/created\",\n \"creator\":
\"http://purl.org/dc/terms/creator\",\n \"dateTime\":
\"http://www.w3.org/2001/XMLSchema#dateTime\",\n \"end\":
\"http://fise.iks-project.eu/ontology/end\",\n \"Enhancement\":
\"http://fise.iks-project.eu/ontology/Enhancement\",\n \"int\":
\"http://www.w3.org/2001/XMLSchema#int\",\n \"selected-text\":
\"http://fise.iks-project.eu/ontology/selected-text\",\n
\"selection-context\":
\"http://fise.iks-project.eu/ontology/selection-context\",\n \"start\":
\"http://fise.iks-project.eu/ontology/start\",\n \"string\":
\"http://www.w3.org/2001/XMLSchema#string\",\n \"TextAnnotation\":
\"http://fise.iks-project.eu/ontology/TextAnnotation\",\n \"type\":
\"http://purl.org/dc/terms/type\"\n },\n \"@subject\":
\"urn:iks-project:enhancer:test:text-annotation:Person\",\n \"@type\": [\n
\"Enhancement\",\n \"TextAnnotation\"\n ],\n
\"created\": {\n \"@literal\": \""+this.expectedW3CFormattedDate+"\",\n
\"@datatype\": \"dateTime\"\n },\n \"creator\": {\n \"@literal\":
\"urn:iks-project:enhancer:test:dummyEngine\",\n \"@datatype\": \"@iri\"\n
},\n \"end\": {\n \"@literal\": \"20\",\n \"@datatype\": \"int\"\n },\n
\"selected-text\": {\n \"@literal\": \"Patrick Marshall\",\n
\"@datatype\": \"string\"\n },\n \"selection-context\": {\n \"@literal\":
\"Dr. Patrick Marshall (1869 - November 1950) was a geologist who lived in New
Zealand and worked at the University of Otago.\",\n \"@datatype\":
\"string\"\n },\n \"start\": {\n \"@literal\": \"4\",\n \"@datatype\":
\"int\"\n },\n \"type\": {\n \"@literal\":
\"http://dbpedia.org/ontology/Person\",\n \"@datatype\": \"@iri\"\n }\n}";
String result = serializedGraph.toString();
Assert.assertEquals(expected, result);
}
@@ -158,7 +158,7 @@ public class JsonLdSerializerProviderTes
jsonldProvider.setNamespacePrefixMap(nsMap);
jsonldProvider.serialize(serializedGraph, ci.getMetadata(),
formatIdentifier);
- String expected =
"{\"@context\":{\"/created\":\"http://purl.org/dc/terms/created\",\"/creator\":\"http://purl.org/dc/terms/creator\",\"/type\":\"http://purl.org/dc/terms/type\",\"dateTime\":\"http://www.w3.org/2001/XMLSchema#dateTime\",\"end\":\"http://fise.iks-project.eu/ontology/end\",\"enhancer\":\"http://fise.iks-project.eu/ontology/\",\"int\":\"http://www.w3.org/2001/XMLSchema#int\",\"selected-text\":\"http://fise.iks-project.eu/ontology/selected-text\",\"selection-context\":\"http://fise.iks-project.eu/ontology/selection-context\",\"start\":\"http://fise.iks-project.eu/ontology/start\",\"string\":\"http://www.w3.org/2001/XMLSchema#string\"},\"@subject\":\"urn:iks-project:enhancer:test:text-annotation:Person\",\"@type\":[\"enhancer:Enhancement\",\"enhancer:TextAnnotation\"],\"/created\":{\"@literal\":\""+this.expectedW3CFormattedDate+"\",\"@datatype\":\"dateTime\"},\"/creator\":{\"@literal\":\"urn:iks-project:enhancer:test:dummyEngine\",\"@datatype\":\"@iri\"},
\"/type\":{\"@literal\":\"http://dbpedia.org/ontology/Person\",\"@datatype\":\"@iri\"},\"end\":{\"@literal\":\"20\",\"@datatype\":\"int\"},\"selected-text\":{\"@literal\":\"Patrick
Marshall\",\"@datatype\":\"string\"},\"selection-context\":{\"@literal\":\"Dr.
Patrick Marshall (1869 - November 1950) was a geologist who lived in New
Zealand and worked at the University of
Otago.\",\"@datatype\":\"string\"},\"start\":{\"@literal\":\"4\",\"@datatype\":\"int\"}}";
+ String expected =
"{\"@context\":{\"/created\":\"http://purl.org/dc/terms/created\",\"/creator\":\"http://purl.org/dc/terms/creator\",\"/type\":\"http://purl.org/dc/terms/type\",\"dateTime\":\"http://www.w3.org/2001/XMLSchema#dateTime\",\"end\":\"http://fise.iks-project.eu/ontology/end\",\"Enhancement\":\"http://fise.iks-project.eu/ontology/Enhancement\",\"int\":\"http://www.w3.org/2001/XMLSchema#int\",\"selected-text\":\"http://fise.iks-project.eu/ontology/selected-text\",\"selection-context\":\"http://fise.iks-project.eu/ontology/selection-context\",\"start\":\"http://fise.iks-project.eu/ontology/start\",\"string\":\"http://www.w3.org/2001/XMLSchema#string\",\"TextAnnotation\":\"http://fise.iks-project.eu/ontology/TextAnnotation\"},\"@subject\":\"urn:iks-project:enhancer:test:text-annotation:Person\",\"@type\":[\"Enhancement\",\"TextAnnotation\"],\"/created\":{\"@literal\":\""+this.expectedW3CFormattedDate+"\",\"@datatype\":\"dateTime\"},\"/creator\":{\"@literal\":
\"urn:iks-project:enhancer:test:dummyEngine\",\"@datatype\":\"@iri\"},\"/type\":{\"@literal\":\"http://dbpedia.org/ontology/Person\",\"@datatype\":\"@iri\"},\"end\":{\"@literal\":\"20\",\"@datatype\":\"int\"},\"selected-text\":{\"@literal\":\"Patrick
Marshall\",\"@datatype\":\"string\"},\"selection-context\":{\"@literal\":\"Dr.
Patrick Marshall (1869 - November 1950) was a geologist who lived in New
Zealand and worked at the University of
Otago.\",\"@datatype\":\"string\"},\"start\":{\"@literal\":\"4\",\"@datatype\":\"int\"}}";
String result = serializedGraph.toString();
Assert.assertEquals(expected, result);
}
@@ -181,7 +181,7 @@ public class JsonLdSerializerProviderTes
jsonldProvider.setNamespacePrefixMap(nsMap);
jsonldProvider.serialize(serializedGraph, ci.getMetadata(),
formatIdentifier);
- String expected =
"{\"@context\":{\"created\":\"http://purl.org/dc/terms/created\",\"creator\":\"http://purl.org/dc/terms/creator\",\"end\":\"http://fise.iks-project.eu/ontology/end\",\"enhancer\":\"http://fise.iks-project.eu/ontology/\",\"Person\":\"http://dbpedia.org/ontology/Person\",\"selected-text\":\"http://fise.iks-project.eu/ontology/selected-text\",\"selection-context\":\"http://fise.iks-project.eu/ontology/selection-context\",\"start\":\"http://fise.iks-project.eu/ontology/start\",\"type\":\"http://purl.org/dc/terms/type\",\"xmlns\":\"http://www.w3.org/2001/XMLSchema#\",\"@coerce\":{\"@iri\":[\"creator\",\"type\"],\"xmlns:dateTime\":\"created\",\"xmlns:int\":[\"end\",\"start\"],\"xmlns:string\":[\"selected-text\",\"selection-context\"]}},\"@subject\":\"urn:iks-project:enhancer:test:text-annotation:Person\",\"@type\":[\"enhancer:Enhancement\",\"enhancer:TextAnnotation\"],\"created\":\""+this.expectedW3CFormattedDate+"\",\"creator\":\"urn:iks-project:enhancer
:test:dummyEngine\",\"end\":20,\"selected-text\":\"Patrick
Marshall\",\"selection-context\":\"Dr. Patrick Marshall (1869 - November 1950)
was a geologist who lived in New Zealand and worked at the University of
Otago.\",\"start\":4,\"type\":\"Person\"}";
+ String expected =
"{\"@context\":{\"created\":\"http://purl.org/dc/terms/created\",\"creator\":\"http://purl.org/dc/terms/creator\",\"end\":\"http://fise.iks-project.eu/ontology/end\",\"Enhancement\":\"http://fise.iks-project.eu/ontology/Enhancement\",\"Person\":\"http://dbpedia.org/ontology/Person\",\"selected-text\":\"http://fise.iks-project.eu/ontology/selected-text\",\"selection-context\":\"http://fise.iks-project.eu/ontology/selection-context\",\"start\":\"http://fise.iks-project.eu/ontology/start\",\"TextAnnotation\":\"http://fise.iks-project.eu/ontology/TextAnnotation\",\"type\":\"http://purl.org/dc/terms/type\",\"xmlns\":\"http://www.w3.org/2001/XMLSchema#\",\"@coerce\":{\"@iri\":[\"creator\",\"type\"],\"xmlns:dateTime\":\"created\",\"xmlns:int\":[\"end\",\"start\"],\"xmlns:string\":[\"selected-text\",\"selection-context\"]}},\"@subject\":\"urn:iks-project:enhancer:test:text-annotation:Person\",\"@type\":[\"Enhancement\",\"TextAnnotation\"],\"created\":\""+th
is.expectedW3CFormattedDate+"\",\"creator\":\"urn:iks-project:enhancer:test:dummyEngine\",\"end\":20,\"selected-text\":\"Patrick
Marshall\",\"selection-context\":\"Dr. Patrick Marshall (1869 - November 1950)
was a geologist who lived in New Zealand and worked at the University of
Otago.\",\"start\":4,\"type\":\"Person\"}";
String result = serializedGraph.toString();
Assert.assertEquals(expected, result);
}
@@ -204,7 +204,7 @@ public class JsonLdSerializerProviderTes
jsonldProvider.setNamespacePrefixMap(nsMap);
jsonldProvider.serialize(serializedGraph, ci.getMetadata(),
formatIdentifier);
- String expected = "{\n \"@context\": {\n \"created\":
\"http://purl.org/dc/terms/created\",\n \"creator\":
\"http://purl.org/dc/terms/creator\",\n \"dateTime\":
\"http://www.w3.org/2001/XMLSchema#dateTime\",\n \"end\":
\"http://fise.iks-project.eu/ontology/end\",\n \"enhancer\":
\"http://fise.iks-project.eu/ontology/\",\n \"int\":
\"http://www.w3.org/2001/XMLSchema#int\",\n \"selected-text\":
\"http://fise.iks-project.eu/ontology/selected-text\",\n
\"selection-context\":
\"http://fise.iks-project.eu/ontology/selection-context\",\n \"start\":
\"http://fise.iks-project.eu/ontology/start\",\n \"string\":
\"http://www.w3.org/2001/XMLSchema#string\",\n \"type\":
\"http://purl.org/dc/terms/type\"\n },\n \"@subject\":
\"urn:iks-project:enhancer:test:text-annotation:Person\",\n \"@type\": [\n
\"enhancer:Enhancement\",\n \"enhancer:TextAnnotation\"\n ],\n
\"created\":
{\n \"@literal\": \""+this.expectedW3CFormattedDate+"\",\n
\"@datatype\": \"dateTime\"\n },\n \"creator\": {\n \"@literal\":
\"urn:iks-project:enhancer:test:dummyEngine\",\n \"@datatype\":
\"@iri\"\n },\n \"end\": {\n \"@literal\": \"20\",\n
\"@datatype\": \"int\"\n },\n \"selected-text\": {\n \"@literal\":
\"Patrick Marshall\",\n \"@datatype\": \"string\"\n },\n
\"selection-context\": {\n \"@literal\": \"Dr. Patrick Marshall (1869 -
November 1950) was a geologist who lived in New Zealand and worked at the
University of Otago.\",\n \"@datatype\": \"string\"\n },\n
\"start\": {\n \"@literal\": \"4\",\n \"@datatype\": \"int\"\n
},\n \"type\": {\n \"@literal\":
\"http://dbpedia.org/ontology/Person\",\n \"@datatype\": \"@iri\"\n
}\n}";
+ String expected = "{\n \"@context\": {\n \"created\":
\"http://purl.org/dc/terms/created\",\n \"creator\":
\"http://purl.org/dc/terms/creator\",\n \"dateTime\":
\"http://www.w3.org/2001/XMLSchema#dateTime\",\n \"end\":
\"http://fise.iks-project.eu/ontology/end\",\n \"Enhancement\":
\"http://fise.iks-project.eu/ontology/Enhancement\",\n \"int\":
\"http://www.w3.org/2001/XMLSchema#int\",\n \"selected-text\":
\"http://fise.iks-project.eu/ontology/selected-text\",\n
\"selection-context\":
\"http://fise.iks-project.eu/ontology/selection-context\",\n \"start\":
\"http://fise.iks-project.eu/ontology/start\",\n \"string\":
\"http://www.w3.org/2001/XMLSchema#string\",\n \"TextAnnotation\":
\"http://fise.iks-project.eu/ontology/TextAnnotation\",\n \"type\":
\"http://purl.org/dc/terms/type\"\n },\n \"@subject\":
\"urn:iks-project:enhancer:test:text-annotation:Person\",\n \"@type\": [
\n \"Enhancement\",\n \"TextAnnotation\"\n ],\n
\"created\": {\n \"@literal\": \""+this.expectedW3CFormattedDate+"\",\n
\"@datatype\": \"dateTime\"\n },\n \"creator\": {\n
\"@literal\": \"urn:iks-project:enhancer:test:dummyEngine\",\n
\"@datatype\": \"@iri\"\n },\n \"end\": {\n \"@literal\":
\"20\",\n \"@datatype\": \"int\"\n },\n \"selected-text\": {\n
\"@literal\": \"Patrick Marshall\",\n \"@datatype\": \"string\"\n
},\n \"selection-context\": {\n \"@literal\": \"Dr. Patrick Marshall
(1869 - November 1950) was a geologist who lived in New Zealand and worked at
the University of Otago.\",\n \"@datatype\": \"string\"\n },\n
\"start\": {\n \"@literal\": \"4\",\n \"@datatype\": \"int\"\n
},\n \"type\": {\n \"@literal\":
\"http://dbpedia.org/ontology/Person\",\n \"@datatype\": \"@iri\"\n
}\n}";
String result = serializedGraph.toString();
Assert.assertEquals(expected, result);
}
@@ -227,7 +227,7 @@ public class JsonLdSerializerProviderTes
jsonldProvider.setUseTypeCoercion(true);
jsonldProvider.serialize(serializedGraph, ci.getMetadata(),
formatIdentifier);
- String expected = "{\n \"@context\": {\n \"created\":
\"http://purl.org/dc/terms/created\",\n \"creator\":
\"http://purl.org/dc/terms/creator\",\n \"end\":
\"http://fise.iks-project.eu/ontology/end\",\n \"enhancer\":
\"http://fise.iks-project.eu/ontology/\",\n \"Person\":
\"http://dbpedia.org/ontology/Person\",\n \"selected-text\":
\"http://fise.iks-project.eu/ontology/selected-text\",\n
\"selection-context\":
\"http://fise.iks-project.eu/ontology/selection-context\",\n \"start\":
\"http://fise.iks-project.eu/ontology/start\",\n \"type\":
\"http://purl.org/dc/terms/type\",\n \"xmlns\":
\"http://www.w3.org/2001/XMLSchema#\",\n \"@coerce\": {\n
\"@iri\": [\n \"creator\",\n \"type\"\n
],\n \"xmlns:dateTime\": \"created\",\n \"xmlns:int\":
[\n \"end\",\n \"start\"\n ],\n
\"xmlns:string\": [\n \"selected-text\",\n
\"selection-context\"\n ]\n }\n },\n \"@subject\":
\"urn:iks-project:enhancer:test:text-annotation:Person\",\n \"@type\": [\n
\"enhancer:Enhancement\",\n \"enhancer:TextAnnotation\"\n ],\n
\"created\": \""+this.expectedW3CFormattedDate+"\",\n \"creator\":
\"urn:iks-project:enhancer:test:dummyEngine\",\n \"end\": 20,\n
\"selected-text\": \"Patrick Marshall\",\n \"selection-context\": \"Dr.
Patrick Marshall (1869 - November 1950) was a geologist who lived in New
Zealand and worked at the University of Otago.\",\n \"start\": 4,\n
\"type\": \"Person\"\n}";
+ String expected = "{\n \"@context\": {\n \"created\":
\"http://purl.org/dc/terms/created\",\n \"creator\":
\"http://purl.org/dc/terms/creator\",\n \"end\":
\"http://fise.iks-project.eu/ontology/end\",\n \"Enhancement\":
\"http://fise.iks-project.eu/ontology/Enhancement\",\n \"Person\":
\"http://dbpedia.org/ontology/Person\",\n \"selected-text\":
\"http://fise.iks-project.eu/ontology/selected-text\",\n
\"selection-context\":
\"http://fise.iks-project.eu/ontology/selection-context\",\n \"start\":
\"http://fise.iks-project.eu/ontology/start\",\n \"TextAnnotation\":
\"http://fise.iks-project.eu/ontology/TextAnnotation\",\n \"type\":
\"http://purl.org/dc/terms/type\",\n \"xmlns\":
\"http://www.w3.org/2001/XMLSchema#\",\n \"@coerce\": {\n
\"@iri\": [\n \"creator\",\n \"type\"\n
],\n \"xmlns:dateTime\": \"created\",\n
\"xmlns:int\": [\n \"end\",\n \"start\"\n
],\n \"xmlns:string\": [\n
\"selected-text\",\n \"selection-context\"\n ]\n
}\n },\n \"@subject\":
\"urn:iks-project:enhancer:test:text-annotation:Person\",\n \"@type\": [\n
\"Enhancement\",\n \"TextAnnotation\"\n ],\n \"created\":
\""+this.expectedW3CFormattedDate+"\",\n \"creator\":
\"urn:iks-project:enhancer:test:dummyEngine\",\n \"end\": 20,\n
\"selected-text\": \"Patrick Marshall\",\n \"selection-context\": \"Dr.
Patrick Marshall (1869 - November 1950) was a geologist who lived in New
Zealand and worked at the University of Otago.\",\n \"start\": 4,\n
\"type\": \"Person\"\n}";
String result = serializedGraph.toString();
Assert.assertEquals(expected, result);
}