-
Notifications
You must be signed in to change notification settings - Fork 17
xdi2 core
peacekeeper edited this page Jul 26, 2012
·
42 revisions
Implementation of the XDI graph model and basic features [.jar]
- Implementation of the XDI graph model
- Available backend storage for XDI graphs
- How to (de-)serialize XDI graphs
- How to work with multiplicity
- How to work with dictionaries
- How to work with link contracts and policies
<dependency>
<groupId>xdi2</groupId>
<artifactId>xdi2-core</artifactId>
<version>0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
package xdi2.samples;
import xdi2.core.ContextNode;
import xdi2.core.Graph;
import xdi2.core.impl.memory.MemoryGraphFactory;
import xdi2.core.io.XDIWriterRegistry;
import xdi2.core.xri3.impl.XRI3SubSegment;
public class SimpleCoreSample {
public static void main(String[] args) throws Exception {
Graph graph = MemoryGraphFactory.getInstance().openGraph();
ContextNode root = graph.getRootContextNode();
ContextNode markus = root.createContextNode(new XRI3SubSegment("=markus"));
ContextNode name = markus.createContextNode(new XRI3SubSegment("+name"));
ContextNode email = markus.createContextNode(new XRI3SubSegment("+email"));
name.createLiteral("Markus Sabadello");
email.createLiteral("markus.sabadello@gmail.com");
System.out.println("Serialization in XDI/JSON: \n");
XDIWriterRegistry.forFormat("XDI/JSON", null).write(graph, System.out);
System.out.println();
System.out.println("Serialization in XDI statements:\n");
XDIWriterRegistry.forFormat("XDI DISPLAY", null).write(graph, System.out);
}
}
This work is licensed under a Creative Commons Attribution 4.0 International License.