Reification, Singleton


Hey together,

I really would love to use cayley but I’m not particularly interested in sharing the data across the world like OWT and all other schemas that try to help with reducing ambiguity of shared data --> I just want to model the data for myself.

Now lets say I have following triple <monster> --drops--> <item> and I want to say whats the percentage to drop said item. I need to make the drop itself a node and say <drop123> --chance--> <40%> but is this the supposed way to do it? as it comes with downsides?

I heard of queries getting less verbose or complex and you cannot reuse and you have to know with what drop are you dealing like knowing the id

Also side-note as I digged into this topic I heared that labeled property graphs like neo4j uses them are just triples under the hood but giving another “api” to the developers so how would they model the data I want to describe under the hood?

Yours Patrick


Hi @pkuhlmann!

The answer depends on how you are using Cayley (library vs standalone).

As you mentioned, it only supports quads, so you cannot attach arbitrary metadata to relations. You also pointed out the right solution in general - to use a unique node for the relation. If you also add another triple for the relation type (<drop123> --type-> <drops>) you should be able to query the data you need. Having said that, Cayley’s query optimizer is not perfect, and this specific approach may slow queries down.

The second approach may be to reuse the label field in quads for this purpose. It would only be easy to do if you are using Cayley as a library since not all helpers expose quad labels to the user. This approach will only allow storing 1 metadata field, however, you can use the same approach with drop123 in label to get more fields.

Hope this helps.

We will try to address this issue in the future, however, it may take a lot of time.