本文整理匯總了Java中org.dswarm.graph.json.Statement.setId方法的典型用法代碼示例。如果您正苦於以下問題:Java Statement.setId方法的具體用法?Java Statement.setId怎麽用?Java Statement.setId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.dswarm.graph.json.Statement
的用法示例。
在下文中一共展示了Statement.setId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSerializeStatementWConfidence
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeStatementWConfidence() throws IOException {
final ResourceNode subject = new ResourceNode(1, "http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate predicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node object = new Node(2);
final Statement statement = new Statement(subject, predicate, object);
statement.setId(1);
statement.setConfidence("20");
final String statementJSONString = Util.getJSONObjectMapper().writeValueAsString(statement);
final String expectedJSONString = TestUtil.getResourceAsString("statement_w_confidence.json");
Assert.assertEquals("wrong serialisation", expectedJSONString, statementJSONString);
}
示例2: testSerializeStatementWUUID
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeStatementWUUID() throws IOException {
final ResourceNode subject = new ResourceNode(1, "http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate predicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node object = new Node(2);
final Statement statement = new Statement(subject, predicate, object);
statement.setId(1);
statement.setUUID("18d68601-0623-42b4-ad89-f8954cc25912");
final String statementJSONString = Util.getJSONObjectMapper().writeValueAsString(statement);
final ObjectNode statementJSON = Util.getJSONObjectMapper().readValue(statementJSONString, ObjectNode.class);
final String expectedJSONString = TestUtil.getResourceAsString("statementwuuid.json");
final ObjectNode expectedJSON = Util.getJSONObjectMapper().readValue(expectedJSONString, ObjectNode.class);
Assert.assertEquals("wrong serialisation", expectedJSON, statementJSON);
}
示例3: testSerializeStatementwOrder
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeStatementwOrder() throws IOException {
final ResourceNode subject = new ResourceNode(1, "http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate predicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node object = new Node(2);
final long statementId = 1;
final long order = 1;
final Statement statement = new Statement(subject, predicate, object);
statement.setId(statementId);
statement.setOrder(order);
final String statementJSONString = Util.getJSONObjectMapper().writeValueAsString(statement);
final String expectedJSONString = TestUtil.getResourceAsString("statementworder.json");
Assert.assertEquals("wrong serialisation", expectedJSONString, statementJSONString);
}
示例4: testSerializeModel
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeModel() throws IOException {
final ResourceNode subject = new ResourceNode(1, "http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate predicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node object = new Node(2);
final Statement statement = new Statement(subject, predicate, object);
statement.setId(1);
final Resource resource = new Resource("http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
resource.addStatement(statement);
final Model model = new Model();
model.addResource(resource);
final String modelJSONString = Util.getJSONObjectMapper().writeValueAsString(model);
final String expectedJSONString = TestUtil.getResourceAsString("model.json");
Assert.assertEquals("wrong serialisation", expectedJSONString, modelJSONString);
}
示例5: testSerializeResourceWStatementWUUID
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeResourceWStatementWUUID() throws IOException {
final ResourceNode subject = new ResourceNode(1, "http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate predicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node object = new Node(2);
final Statement statement = new Statement(subject, predicate, object);
statement.setId(1);
statement.setUUID("18d68601-0623-42b4-ad89-f8954cc25912");
final Resource resource = new Resource("http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
resource.addStatement(statement);
final String resourceJSONString = Util.getJSONObjectMapper().writeValueAsString(resource);
final String expectedJSONString = TestUtil.getResourceAsString("resourcewstatementwuuid.json");
Assert.assertEquals("wrong serialisation", expectedJSONString, resourceJSONString);
}
示例6: testSerializeStatement
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeStatement() throws IOException {
final ResourceNode subject = new ResourceNode(1, "http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate predicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node object = new Node(2);
final Statement statement = new Statement(subject, predicate, object);
statement.setId(1);
final String statementJSONString = Util.getJSONObjectMapper().writeValueAsString(statement);
final String expectedJSONString = TestUtil.getResourceAsString("statement.json");
Assert.assertEquals("wrong serialisation", expectedJSONString, statementJSONString);
}
示例7: testSerializeStatementWDataModelResource
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeStatementWDataModelResource() throws IOException {
final ResourceNode subject = new ResourceNode(1, "http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate predicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node object = new ResourceNode((long) 2, "http://example.com/dataresource", "http://example.com");
final Statement statement = new Statement(subject, predicate, object);
statement.setId(1);
final String statementJSONString = Util.getJSONObjectMapper().writeValueAsString(statement);
final String expectedJSONString = TestUtil.getResourceAsString("statement_w_data_model_resource.json");
Assert.assertEquals("wrong serialisation", expectedJSONString, statementJSONString);
}
示例8: testDeserializeStatementWConfidence
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testDeserializeStatementWConfidence() throws IOException {
final String statementJSONString = TestUtil.getResourceAsString("statement_w_confidence.json");
final Statement statement = Util.getJSONObjectMapper().readValue(statementJSONString, Statement.class);
Assert.assertNotNull("deserialized statement shouldn't be null", statement);
final ResourceNode expectedSubject = new ResourceNode(1,
"http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate expectedPredicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node expectedObject = new Node(2);
final Statement expectedStatement = new Statement(expectedSubject, expectedPredicate, expectedObject);
expectedStatement.setId(1);
expectedStatement.setConfidence("20");
Assert.assertEquals("ids of the statements should be equal", expectedStatement.getId(), statement.getId());
Assert.assertNotNull("subject of the statement shouldn't be null", statement.getSubject());
Assert.assertEquals("ids of the statements' subjects should be equal", expectedStatement.getSubject().getId(), statement.getSubject().getId());
Assert.assertEquals("types of the statements' subjects should be equal", expectedStatement.getSubject().getType(), statement.getSubject()
.getType());
Assert.assertNotNull("predicate of the statement shouldn't be null", statement.getPredicate());
Assert.assertEquals("ids of the statements' predicates should be equal", expectedStatement.getPredicate().getUri(), statement.getPredicate()
.getUri());
Assert.assertNotNull("object of the statement shouldn't be null", statement.getObject());
Assert.assertEquals("ids of the statements' objects should be equal", expectedStatement.getObject().getId(), statement.getObject().getId());
Assert.assertEquals("types of the statements' objects should be equal", expectedStatement.getObject().getType(), statement.getObject()
.getType());
Assert.assertEquals("uris of the statements' subjects should be equal", ((ResourceNode) expectedStatement.getSubject()).getUri(),
((ResourceNode) statement.getSubject()).getUri());
Assert.assertNotNull("subject of the confidence shouldn't be null", statement.getConfidence());
Assert.assertEquals("confidences of the statements should be equal", expectedStatement.getConfidence(), statement.getConfidence());
}
示例9: testDeserializeStatementWDataModelResource
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testDeserializeStatementWDataModelResource() throws IOException {
final String statementJSONString = TestUtil.getResourceAsString("statement_w_data_model_resource.json");
final Statement statement = Util.getJSONObjectMapper().readValue(statementJSONString, Statement.class);
Assert.assertNotNull("deserialized statement shouldn't be null", statement);
final ResourceNode expectedSubject = new ResourceNode(1,
"http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate expectedPredicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node expectedObject = new ResourceNode((long) 2, "http://example.com/dataresource", "http://example.com");
final Statement expectedStatement = new Statement(expectedSubject, expectedPredicate, expectedObject);
expectedStatement.setId(1);
Assert.assertEquals("ids of the statements should be equal", expectedStatement.getId(), statement.getId());
Assert.assertNotNull("subject of the statement shouldn't be null", statement.getSubject());
Assert.assertEquals("ids of the statements' subjects should be equal", expectedStatement.getSubject().getId(), statement.getSubject().getId());
Assert.assertEquals("types of the statements' subjects should be equal", expectedStatement.getSubject().getType(), statement.getSubject()
.getType());
Assert.assertNotNull("predicate of the statement shouldn't be null", statement.getPredicate());
Assert.assertEquals("ids of the statements' predicates should be equal", expectedStatement.getPredicate().getUri(), statement.getPredicate()
.getUri());
Assert.assertNotNull("object of the statement shouldn't be null", statement.getObject());
Assert.assertEquals("ids of the statements' objects should be equal", expectedStatement.getObject().getId(), statement.getObject().getId());
Assert.assertEquals("types of the statements' objects should be equal", expectedStatement.getObject().getType(), statement.getObject()
.getType());
Assert.assertNotNull(((ResourceNode) expectedStatement.getObject()).getDataModel());
Assert.assertEquals("data models of the statements' objects should be equal", ((ResourceNode) expectedStatement.getObject()).getDataModel(), ((ResourceNode) statement.getObject()).getDataModel());
Assert.assertEquals("uris of the statements' subjects should be equal", ((ResourceNode) expectedStatement.getSubject()).getUri(),
((ResourceNode) statement.getSubject()).getUri());
}
示例10: testDeserializeStatementWDataModelResourceAndEvidence
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testDeserializeStatementWDataModelResourceAndEvidence() throws IOException {
final String statementJSONString = TestUtil.getResourceAsString("statement_w_data_model_resource_and_evidence.json");
final Statement statement = Util.getJSONObjectMapper().readValue(statementJSONString, Statement.class);
Assert.assertNotNull("deserialized statement shouldn't be null", statement);
final ResourceNode expectedSubject = new ResourceNode(1,
"http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate expectedPredicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node expectedObject = new ResourceNode((long) 2, "http://example.com/dataresource", "http://example.com");
final Statement expectedStatement = new Statement(expectedSubject, expectedPredicate, expectedObject);
expectedStatement.setId(1);
expectedStatement.setEvidence("0815");
Assert.assertEquals("ids of the statements should be equal", expectedStatement.getId(), statement.getId());
Assert.assertNotNull("subject of the statement shouldn't be null", statement.getSubject());
Assert.assertEquals("ids of the statements' subjects should be equal", expectedStatement.getSubject().getId(), statement.getSubject().getId());
Assert.assertEquals("types of the statements' subjects should be equal", expectedStatement.getSubject().getType(), statement.getSubject()
.getType());
Assert.assertNotNull("predicate of the statement shouldn't be null", statement.getPredicate());
Assert.assertEquals("ids of the statements' predicates should be equal", expectedStatement.getPredicate().getUri(), statement.getPredicate()
.getUri());
Assert.assertNotNull("object of the statement shouldn't be null", statement.getObject());
Assert.assertEquals("ids of the statements' objects should be equal", expectedStatement.getObject().getId(), statement.getObject().getId());
Assert.assertEquals("types of the statements' objects should be equal", expectedStatement.getObject().getType(), statement.getObject()
.getType());
Assert.assertNotNull(((ResourceNode) expectedStatement.getObject()).getDataModel());
Assert.assertEquals("data models of the statements' objects should be equal", ((ResourceNode) expectedStatement.getObject()).getDataModel(), ((ResourceNode) statement.getObject()).getDataModel());
Assert.assertEquals("uris of the statements' subjects should be equal", ((ResourceNode) expectedStatement.getSubject()).getUri(),
((ResourceNode) statement.getSubject()).getUri());
Assert.assertNotNull("evidence of the statement shouldn't be null", statement.getEvidence());
Assert.assertEquals("evidences of the statements should be equal", expectedStatement.getEvidence(), statement.getEvidence());
}
示例11: testDeserializeStatementWUUID
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testDeserializeStatementWUUID() throws IOException {
final String statementJSONString = TestUtil.getResourceAsString("statementwuuid.json");
final Statement statement = Util.getJSONObjectMapper().readValue(statementJSONString, Statement.class);
Assert.assertNotNull("deserialized statement shouldn't be null", statement);
final ResourceNode expectedSubject = new ResourceNode(1,
"http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate expectedPredicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node expectedObject = new Node(2);
final Statement expectedStatement = new Statement(expectedSubject, expectedPredicate,
expectedObject);
expectedStatement.setId(1);
expectedStatement.setUUID("18d68601-0623-42b4-ad89-f8954cc25912");
Assert.assertEquals("ids of the statements should be equal", expectedStatement.getId(), statement.getId());
Assert.assertNotNull("uuid of the statement shouldn't be null", statement.getUUID());
Assert.assertEquals("uuids of the statements should be equal", expectedStatement.getUUID(), statement.getUUID());
Assert.assertNotNull("subject of the statement shouldn't be null", statement.getSubject());
Assert.assertEquals("ids of the statements' subjects should be equal", expectedStatement.getSubject().getId(), statement.getSubject().getId());
Assert.assertEquals("types of the statements' subjects should be equal", expectedStatement.getSubject().getType(), statement.getSubject()
.getType());
Assert.assertNotNull("predicate of the statement shouldn't be null", statement.getPredicate());
Assert.assertEquals("ids of the statements' predicates should be equal", expectedStatement.getPredicate().getUri(), statement.getPredicate()
.getUri());
Assert.assertNotNull("object of the statement shouldn't be null", statement.getObject());
Assert.assertEquals("ids of the statements' objects should be equal", expectedStatement.getObject().getId(), statement.getObject().getId());
Assert.assertEquals("types of the statements' objects should be equal", expectedStatement.getObject().getType(), statement.getObject()
.getType());
Assert.assertEquals("uris of the statements' subjects should be equal", ((ResourceNode) expectedStatement.getSubject()).getUri(),
((ResourceNode) statement.getSubject()).getUri());
}
示例12: testDeserializeStatementWOrder
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testDeserializeStatementWOrder() throws IOException {
final String statementJSONString = TestUtil.getResourceAsString("statementworder.json");
final Statement statement = Util.getJSONObjectMapper().readValue(statementJSONString, Statement.class);
Assert.assertNotNull("deserialized statement shouldn't be null", statement);
final ResourceNode expectedSubject = new ResourceNode(1,
"http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate expectedPredicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node expectedObject = new Node(2);
final long statementId = 1;
final long order = 1;
final Statement expectedStatement = new Statement(expectedSubject, expectedPredicate, expectedObject);
expectedStatement.setId(statementId);
expectedStatement.setOrder(order);
Assert.assertEquals("ids of the statements should be equal", expectedStatement.getId(), statement.getId());
Assert.assertNotNull("subject of the statement shouldn't be null", statement.getSubject());
Assert.assertEquals("ids of the statements' subjects should be equal", expectedStatement.getSubject().getId(), statement.getSubject().getId());
Assert.assertEquals("types of the statements' subjects should be equal", expectedStatement.getSubject().getType(), statement.getSubject()
.getType());
Assert.assertNotNull("predicate of the statement shouldn't be null", statement.getPredicate());
Assert.assertEquals("ids of the statements' predicates should be equal", expectedStatement.getPredicate().getUri(), statement.getPredicate()
.getUri());
Assert.assertNotNull("object of the statement shouldn't be null", statement.getObject());
Assert.assertEquals("ids of the statements' objects should be equal", expectedStatement.getObject().getId(), statement.getObject().getId());
Assert.assertEquals("types of the statements' objects should be equal", expectedStatement.getObject().getType(), statement.getObject()
.getType());
Assert.assertEquals("uris of the statements' subjects should be equal", ((ResourceNode) expectedStatement.getSubject()).getUri(),
((ResourceNode) statement.getSubject()).getUri());
Assert.assertNotNull("order of the statement shouldn't be null", statement.getOrder());
Assert.assertEquals("orders of the statements should be equal", expectedStatement.getOrder(), statement.getOrder());
}
示例13: testDeserializeStatementWOrderAndUUID
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testDeserializeStatementWOrderAndUUID() throws IOException {
final String statementJSONString = TestUtil.getResourceAsString("statementworderanduuid.json");
final Statement statement = Util.getJSONObjectMapper().readValue(statementJSONString, Statement.class);
Assert.assertNotNull("deserialized statement shouldn't be null", statement);
final ResourceNode expectedSubject = new ResourceNode(1,
"http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate expectedPredicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node expectedObject = new Node(2);
final long statementId = 1;
final long order = 1;
final String uuid = "18d68601-0623-42b4-ad89-f8954cc25912";
final Statement expectedStatement = new Statement(expectedSubject, expectedPredicate, expectedObject);
expectedStatement.setId(statementId);
expectedStatement.setUUID(uuid);
expectedStatement.setOrder(order);
Assert.assertEquals("ids of the statements should be equal", expectedStatement.getId(), statement.getId());
Assert.assertNotNull("uuid of the statement shouldn't be null", statement.getUUID());
Assert.assertEquals("uuids of the statements should be equal", expectedStatement.getUUID(), statement.getUUID());
Assert.assertNotNull("subject of the statement shouldn't be null", statement.getSubject());
Assert.assertEquals("ids of the statements' subjects should be equal", expectedStatement.getSubject().getId(), statement.getSubject().getId());
Assert.assertEquals("types of the statements' subjects should be equal", expectedStatement.getSubject().getType(), statement.getSubject()
.getType());
Assert.assertNotNull("predicate of the statement shouldn't be null", statement.getPredicate());
Assert.assertEquals("ids of the statements' predicates should be equal", expectedStatement.getPredicate().getUri(), statement.getPredicate()
.getUri());
Assert.assertNotNull("object of the statement shouldn't be null", statement.getObject());
Assert.assertEquals("ids of the statements' objects should be equal", expectedStatement.getObject().getId(), statement.getObject().getId());
Assert.assertEquals("types of the statements' objects should be equal", expectedStatement.getObject().getType(), statement.getObject()
.getType());
Assert.assertEquals("uris of the statements' subjects should be equal", ((ResourceNode) expectedStatement.getSubject()).getUri(),
((ResourceNode) statement.getSubject()).getUri());
Assert.assertNotNull("order of the statement shouldn't be null", statement.getOrder());
Assert.assertEquals("orders of the statements should be equal", expectedStatement.getOrder(), statement.getOrder());
}
示例14: testDeserializeResource
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testDeserializeResource() throws IOException {
final String resourceJSONString = TestUtil.getResourceAsString("resource.json");
final Resource resource = Util.getJSONObjectMapper().readValue(resourceJSONString, Resource.class);
Assert.assertNotNull("deserialized resource shouldn't be null", resource);
final ResourceNode expectedSubject = new ResourceNode(1,
"http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate expectedPredicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node expectedObject = new Node(2);
final Statement expectedStatement = new Statement(expectedSubject, expectedPredicate, expectedObject);
expectedStatement.setId(1);
final Resource expectedResource = new Resource("http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
expectedResource.addStatement(expectedStatement);
Assert.assertEquals("uris of the resource should be equal", expectedResource.getUri(), resource.getUri());
Assert.assertNotNull("there should be some statements for the resource", resource.getStatements());
Assert.assertEquals("statement size of the resource should be equal", expectedResource.getStatements().size(), resource.getStatements()
.size());
Assert.assertEquals("ids of the statements should be equal", expectedStatement.getId(), resource.getStatements().iterator().next().getId());
Assert.assertNotNull("subject of the statement shouldn't be null", resource.getStatements().iterator().next().getSubject());
Assert.assertEquals("ids of the statements' subjects should be equal", expectedStatement.getSubject().getId(), resource.getStatements()
.iterator().next().getSubject().getId());
Assert.assertEquals("types of the statements' subjects should be equal", expectedStatement.getSubject().getType(), resource.getStatements()
.iterator().next().getSubject().getType());
Assert.assertNotNull("predicate of the statement shouldn't be null", resource.getStatements().iterator().next().getPredicate());
Assert.assertEquals("ids of the statements' predicates should be equal", expectedStatement.getPredicate().getUri(), resource.getStatements()
.iterator().next().getPredicate().getUri());
Assert.assertNotNull("object of the statement shouldn't be null", resource.getStatements().iterator().next().getObject());
Assert.assertEquals("ids of the statements' objects should be equal", expectedStatement.getObject().getId(), resource.getStatements()
.iterator().next().getObject().getId());
Assert.assertEquals("types of the statements' objects should be equal", expectedStatement.getObject().getType(), resource.getStatements()
.iterator().next().getObject().getType());
Assert.assertEquals("uris of the statements' subjects should be equal", ((ResourceNode) expectedStatement.getSubject()).getUri(),
((ResourceNode) resource.getStatements().iterator().next().getSubject()).getUri());
}
示例15: testDeserializeResourceWStatementWOrder
import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testDeserializeResourceWStatementWOrder() throws IOException {
final String resourceJSONString = TestUtil.getResourceAsString("resourcewstatementworder.json");
final Resource resource = Util.getJSONObjectMapper().readValue(resourceJSONString, Resource.class);
Assert.assertNotNull("deserialized resource shouldn't be null", resource);
final ResourceNode expectedSubject = new ResourceNode(1,
"http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
final Predicate expectedPredicate = new Predicate("http://www.openarchives.org/OAI/2.0/header");
final Node expectedObject = new Node(2);
final long statementId = 1;
final long order = 1;
final Statement expectedStatement = new Statement(expectedSubject, expectedPredicate, expectedObject);
expectedStatement.setId(statementId);
expectedStatement.setOrder(order);
final Resource expectedResource = new Resource("http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
expectedResource.addStatement(expectedStatement);
Assert.assertEquals("uris of the resource should be equal", expectedResource.getUri(), resource.getUri());
Assert.assertNotNull("there should be some statements for the resource", resource.getStatements());
Assert.assertEquals("statement size of the resource should be equal", expectedResource.getStatements().size(), resource.getStatements()
.size());
Assert.assertEquals("ids of the statements should be equal", expectedStatement.getId(), resource.getStatements().iterator().next().getId());
Assert.assertNotNull("subject of the statement shouldn't be null", resource.getStatements().iterator().next().getSubject());
Assert.assertEquals("ids of the statements' subjects should be equal", expectedStatement.getSubject().getId(), resource.getStatements()
.iterator().next().getSubject().getId());
Assert.assertEquals("types of the statements' subjects should be equal", expectedStatement.getSubject().getType(), resource.getStatements()
.iterator().next().getSubject().getType());
Assert.assertNotNull("predicate of the statement shouldn't be null", resource.getStatements().iterator().next().getPredicate());
Assert.assertEquals("ids of the statements' predicates should be equal", expectedStatement.getPredicate().getUri(), resource.getStatements()
.iterator().next().getPredicate().getUri());
Assert.assertNotNull("object of the statement shouldn't be null", resource.getStatements().iterator().next().getObject());
Assert.assertEquals("ids of the statements' objects should be equal", expectedStatement.getObject().getId(), resource.getStatements()
.iterator().next().getObject().getId());
Assert.assertEquals("types of the statements' objects should be equal", expectedStatement.getObject().getType(), resource.getStatements()
.iterator().next().getObject().getType());
Assert.assertEquals("uris of the statements' subjects should be equal", ((ResourceNode) expectedStatement.getSubject()).getUri(),
((ResourceNode) resource.getStatements().iterator().next().getSubject()).getUri());
Assert.assertNotNull("order of the statement shouldn't be null", resource.getStatements().iterator().next().getOrder());
Assert.assertEquals("statements' orders should be equal", expectedStatement.getOrder(), resource.getStatements().iterator().next().getOrder());
}