Enforcing Schema - Limiting edge label to 2 types of vertex labels

31 views
Skip to first unread message

Adam

unread,
Jul 17, 2015, 10:01:24 AM7/17/15
to aureliu...@googlegroups.com

I'm working on my first Titan Graph implementation, but ran into an issue with enforcing the schema. Here's my set up:

Configuration conf = new BaseConfiguration();

conf
.setProperty("storage.backend", "cassandra");
conf
.setProperty("storage.hostname", "127.0.0.1");
conf
.setProperty("index.search.backend", "elasticsearch");
conf
.setProperty("index.search.hostname", "127.0.0.1");
conf
.setProperty("index.search.elasticsearch.client-only", "true");
conf
.setProperty("schema.default", "none");

TitanGraph g = TitanFactory.open(conf);
TitanManagement mgmt = g.getManagementSystem();

VertexLabel personLabel = mgmt.makeVertexLabel("person").make();
VertexLabel locationLabel = mgmt.makeVertexLabel("location").make();
VertexLabel organizationLabel = mgmt.makeVertexLabel("organization").make();

mgmt
.makeEdgeLabel("lives in").multiplicity(Multiplicity.MANY2ONE).make();

mgmt
.commit();
g.shutdown();

I want to enforce that a "lives in" edge can ONLY occur from a "person" to a "location", but I can't find the logic to do it.

Daniel Kuppitz

unread,
Jul 23, 2015, 9:06:15 AM7/23/15
to Aurelius, ar...@georgetown.edu, ar...@georgetown.edu
That kind of constraint has to be handled by your application.

Cheers,
Daniel
Reply all
Reply to author
Forward
0 new messages