本文整理汇总了Java中org.dswarm.graph.json.Node类的典型用法代码示例。如果您正苦于以下问题:Java Node类的具体用法?Java Node怎么用?Java Node使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Node类属于org.dswarm.graph.json包,在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createStatement
import org.dswarm.graph.json.Node; //导入依赖的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;
}
示例2: testSerializeStatementWConfidence
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例3: testSerializeStatementWDataModelResourceAndEvidence
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例4: testSerializeStatementWUUID
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例5: testSerializeStatementWUUIDWithoutId
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例6: testSerializeStatementwOrder
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例7: testSerializeStatementwOrderAndUUID
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例8: testSerializeStatementwOrderAndUUIDWithoutId
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例9: testSerializeModel
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例10: testSerializeModelWResourceWStatementWUUID
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例11: testSerializeModelWResourceWStatementWOrder
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例12: testSerializeModelWResourceWStatementWOrderAndUUID
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例13: testSerializeResource
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例14: testSerializeResourceWStatementWUUID
import org.dswarm.graph.json.Node; //导入依赖的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);
}
示例15: testSerializeResourceWStatementWOrder
import org.dswarm.graph.json.Node; //导入依赖的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);
}