當前位置: 首頁>>代碼示例>>Java>>正文


Java Statement.setOrder方法代碼示例

本文整理匯總了Java中org.dswarm.graph.json.Statement.setOrder方法的典型用法代碼示例。如果您正苦於以下問題:Java Statement.setOrder方法的具體用法?Java Statement.setOrder怎麽用?Java Statement.setOrder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.dswarm.graph.json.Statement的用法示例。


在下文中一共展示了Statement.setOrder方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createStatement

import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
private Statement createStatement(final Long id, final String uuid, final Node subject, final Predicate predicate, final Node object,
                                  final Long order, final String evidence, final String confidence) {

	final Statement st = new Statement(subject, predicate, object);

	if (id != null) {

		st.setId(id);
	}

	st.setUUID(uuid);
	st.setOrder(order);
	st.setEvidence(evidence);
	st.setConfidence(confidence);

	return st;
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:18,代碼來源:ModelParser.java

示例2: 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);
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:19,代碼來源:StatementTest.java

示例3: testSerializeStatementwOrderAndUUID

import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeStatementwOrderAndUUID() 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.setUUID("18d68601-0623-42b4-ad89-f8954cc25912");
	statement.setOrder(order);
	final String statementJSONString = Util.getJSONObjectMapper().writeValueAsString(statement);

	final String expectedJSONString = TestUtil.getResourceAsString("statementworderanduuid.json");

	Assert.assertEquals("wrong serialisation", expectedJSONString, statementJSONString);
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:20,代碼來源:StatementTest.java

示例4: testSerializeStatementwOrderAndUUIDWithoutId

import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeStatementwOrderAndUUIDWithoutId() 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 order = 1;

	final Statement statement = new Statement(subject, predicate, object);
	statement.setUUID("18d68601-0623-42b4-ad89-f8954cc25912");
	statement.setOrder(order);
	final String statementJSONString = Util.getJSONObjectMapper().writeValueAsString(statement);

	final String expectedJSONString = TestUtil.getResourceAsString("statementworderanduuidwithoutid.json");

	Assert.assertEquals("wrong serialisation", expectedJSONString, statementJSONString);
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:18,代碼來源:StatementTest.java

示例5: testSerializeModelWResourceWStatementWOrder

import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeModelWResourceWStatementWOrder() 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 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("modelwresourcewstatementworder.json");

	Assert.assertEquals("wrong serialisation", expectedJSONString, modelJSONString);
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:23,代碼來源:ModelTest.java

示例6: testSerializeModelWResourceWStatementWOrderAndUUID

import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeModelWResourceWStatementWOrderAndUUID() 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.setUUID("18d68601-0623-42b4-ad89-f8954cc25912");
	statement.setOrder(order);
	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("modelwresourcewstatementworderanduuid.json");

	Assert.assertEquals("wrong serialisation", expectedJSONString, modelJSONString);
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:24,代碼來源:ModelTest.java

示例7: testSerializeResourceWStatementWOrder

import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeResourceWStatementWOrder() 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 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("resourcewstatementworder.json");

	Assert.assertEquals("wrong serialisation", expectedJSONString, resourceJSONString);
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:21,代碼來源:ResourceTest.java

示例8: testSerializeResourceWStatementWOrderAndUUID

import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testSerializeResourceWStatementWOrderAndUUID() 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.setUUID("18d68601-0623-42b4-ad89-f8954cc25912");
	statement.setOrder(order);
	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("resourcewstatementworderanduuid.json");

	Assert.assertEquals("wrong serialisation", expectedJSONString, resourceJSONString);
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:22,代碼來源:ResourceTest.java

示例9: readStatement

import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
public Statement readStatement(final Relationship rel) throws DMPGraphException {

		final org.dswarm.graph.json.Node subject = readObject(rel.getStartNode());
		final Predicate predicate = getPredicate(rel.getType().name());
		final org.dswarm.graph.json.Node object = readObject(rel.getEndNode());
		final Long uuid = (Long) rel.getProperty(GraphStatics.UUID_PROPERTY, null);
		final Long order = (Long) rel.getProperty(GraphStatics.ORDER_PROPERTY, null);
		final String confidence = (String) rel.getProperty(GraphStatics.CONFIDENCE_PROPERTY, null);
		final String evidence = (String) rel.getProperty(GraphStatics.EVIDENCE_PROPERTY, null);

		final Statement statement = new Statement(subject, predicate, object);
		statement.setOrder(order);

		if(uuid != null) {

			statement.setUUID(uuid.toString());
		}

		if(confidence != null) {

			statement.setConfidence(confidence);
		}

		if(evidence != null) {

			statement.setEvidence(evidence);
		}

		return statement;
	}
 
開發者ID:dswarm,項目名稱:dswarm-graph-neo4j,代碼行數:31,代碼來源:PropertyGraphGDMReaderHelper.java

示例10: 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());
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:37,代碼來源:StatementTest.java

示例11: 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());
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:41,代碼來源:StatementTest.java

示例12: testDeserializeStatementWOrderAndUUIDWithoutId

import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testDeserializeStatementWOrderAndUUIDWithoutId() throws IOException {

	final String statementJSONString = TestUtil.getResourceAsString("statementworderanduuidwithoutid.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 order = 1;
	final String uuid = "18d68601-0623-42b4-ad89-f8954cc25912";

	final Statement expectedStatement = new Statement(expectedSubject, expectedPredicate, expectedObject);
	expectedStatement.setUUID(uuid);
	expectedStatement.setOrder(order);

	Assert.assertNull("id of the statement should be null", statement.getId());
	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());
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:40,代碼來源:StatementTest.java

示例13: testDeserializeModelWResourceWStatementWOrder

import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testDeserializeModelWResourceWStatementWOrder() throws IOException {

	final String modelJSONString = TestUtil.getResourceAsString("modelwresourcewstatementworder.json");
	final Model model = Util.getJSONObjectMapper().readValue(modelJSONString, Model.class);

	Assert.assertNotNull("deserialized model shouldn't be null", model);

	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);
	final Model expectedModel = new Model();
	expectedModel.addResource(expectedResource);

	Assert.assertNotNull("model shouldn't be null", model);
	Assert.assertNotNull("model resources shouldn't be null", model.getResources());
	Assert.assertEquals("resource size of the model should be equal", expectedModel.getResources().size(), model.getResources().size());

	final Resource resource = model.getResources().iterator().next();

	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());
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:54,代碼來源:ModelTest.java

示例14: testDeserializeModelWResourceWStatementWOrderAndUUID

import org.dswarm.graph.json.Statement; //導入方法依賴的package包/類
@Test
public void testDeserializeModelWResourceWStatementWOrderAndUUID() throws IOException {

	final String modelJSONString = TestUtil.getResourceAsString("modelwresourcewstatementworderanduuid.json");
	final Model model = Util.getJSONObjectMapper().readValue(modelJSONString, Model.class);

	Assert.assertNotNull("deserialized model shouldn't be null", model);

	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.setUUID("18d68601-0623-42b4-ad89-f8954cc25912");
	expectedStatement.setOrder(order);

	final Resource expectedResource = new Resource("http://data.slub-dresden.de/datamodels/22/records/18d68601-0623-42b4-ad89-f8954cc25912");
	expectedResource.addStatement(expectedStatement);
	final Model expectedModel = new Model();
	expectedModel.addResource(expectedResource);

	Assert.assertNotNull("model shouldn't be null", model);
	Assert.assertNotNull("model resources shouldn't be null", model.getResources());
	Assert.assertEquals("resource size of the model should be equal", expectedModel.getResources().size(), model.getResources().size());

	final Resource resource = model.getResources().iterator().next();

	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("the uuid shouldn't be null", resource.getStatements().iterator().next().getUUID());
	Assert.assertEquals("uuids of the statements' subjects should be equal", expectedStatement.getUUID(), resource.getStatements().iterator()
			.next().getUUID());
	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());
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:58,代碼來源:ModelTest.java

示例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());
}
 
開發者ID:dswarm,項目名稱:dswarm-gdm-java,代碼行數:46,代碼來源:ResourceTest.java


注:本文中的org.dswarm.graph.json.Statement.setOrder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。