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


Java Statement類代碼示例

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


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

示例1: processGDMQualifiedAttributes

import org.dswarm.graph.json.Statement; //導入依賴的package包/類
private Optional<List<Snak>> processGDMQualifiedAttributes(final Statement statement) {

		final List<Snak> snakList = new ArrayList<>();

		final Optional<Snak> optionalConfidence = processGDMQualifiedAttribute(CONFIDENCE_QUALIFIED_ATTRIBUTE_IDENTIFIER, statement.getConfidence());
		final Optional<Snak> optionalEvidence = processGDMQualifiedAttribute(EVIDENCE_QUALIFIED_ATTRIBUTE_IDENTIFIER, statement.getEvidence());
		final Optional<Snak> optionalOrder = processGDMQualifiedAttribute(ORDER_QUALIFIED_ATTRIBUTE_IDENTIFIER, statement.getOrder());

		// D:SWARM statement uuid
		final Optional<Snak> optionalUUID = processGDMQualifiedAttribute(STATEMENT_UUID_QUALIFIED_ATTRIBUTE_IDENTIFIER, statement.getUUID());

		addToSnakList(optionalConfidence, snakList);
		addToSnakList(optionalEvidence, snakList);
		addToSnakList(optionalOrder, snakList);
		addToSnakList(optionalUUID, snakList);

		if (snakList.isEmpty()) {

			return Optional.empty();
		}

		return Optional.of(snakList);
	}
 
開發者ID:dswarm,項目名稱:wikidata-d-swarm-importer,代碼行數:24,代碼來源:WikidataDswarmImporter.java

示例2: 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

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

示例4: testSerializeStatementWDataModelResourceAndEvidence

import org.dswarm.graph.json.Statement; //導入依賴的package包/類
@Test
public void testSerializeStatementWDataModelResourceAndEvidence() 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);
	statement.setEvidence("0815");
	final String statementJSONString = Util.getJSONObjectMapper().writeValueAsString(statement);

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

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

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

示例6: testSerializeStatementWUUIDWithoutId

import org.dswarm.graph.json.Statement; //導入依賴的package包/類
@Test
public void testSerializeStatementWUUIDWithoutId() 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.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("statementwuuidwithoutid.json");
	final ObjectNode expectedJSON = Util.getJSONObjectMapper().readValue(expectedJSONString, ObjectNode.class);

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

示例7: 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

示例8: 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

示例9: 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

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

示例11: testSerializeModelWResourceWStatementWUUID

import org.dswarm.graph.json.Statement; //導入依賴的package包/類
@Test
public void testSerializeModelWResourceWStatementWUUID() 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 Model model = new Model();
	model.addResource(resource);
	final String modelJSONString = Util.getJSONObjectMapper().writeValueAsString(model);

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

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

示例12: 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

示例13: 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

示例14: testSerializeResource

import org.dswarm.graph.json.Statement; //導入依賴的package包/類
@Test
public void testSerializeResource() 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 String resourceJSONString = Util.getJSONObjectMapper().writeValueAsString(resource);

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

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

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


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