Skip to main content


Using #Cayley as my knowledge graph with #python. (Entities and their relationships are in RDF N-quad format: "subject", "predicate", "object", "label".) But I can barely wrap my head around the Gizmo API syntax. Only simple queries make sense to my tiny brain! Like this returns all the predicates:

`query = graph.V("<predicates>").Out("<are>").All()`

And this returns all the things known about "Bob":

`query = graph.V("Bob").Out().All()`

But what about all predicates for Bob?

🤔

in reply to Gene Boggs

`out()` is what objects Bob is pointing to (not all things known about bob).

Which would not include anything pointing to Bob (`in()` provides that).

But these simply return the objects, if you are interested in predicates, you need `inPredicates()` and `outPredicates()`

in reply to she hacked you

@ekis Seems those functions are only provided by the node version of the API, not the python unfortunately.

I *did* try to code that up in node, but those functions were not cooperating. Maybe I was more confused then...

As a possible workaround, I manually save my predicates as n-quads when I encounter them, where the subject is literally "<predicates>", the predicate is "<are>" and the object is the predicate to save.

I want to get all predicates that the Bob records have.

Confused? 😂

in reply to Gene Boggs

I apologize, let me look up correct API, lol

Most familiar with interacting with it in Go

This entry was edited (1 month ago)
in reply to she hacked you

It's tangled. There are a few APIs. To write to Cayley, you use a POST call to an endpoint.

Maybe I should be using go in this instance.

This entry was edited (1 month ago)