GraphKnowledge

graph-lakehouse

Managing Your Data

This topic provides information about common questions to ask when managing your data.

How do I list all of the graphs in the database?

The following query returns a list of all of the named graphs in Graph Lakehouse:

SELECT DISTINCT ?graph WHERE { GRAPH ?graph { ?s ?p ?o . } }

graph

http://anzograph.com/tickit 1 rows

How do I find all of the triples that reference a resource?

A common task is to find all of the triples in a graph that refer to a particular resource. That resource might be a subject in one triple and an object in another. For example, the person2 resource in the sample tickit graph is referenced as the subject in some triples and the object in other triples. For example:

http://anzograph.com/tickit/person2 http://anzograph.com/tickit/friend http://anzograph.com/tickit/person12595
http://anzograph.com/tickit/person12595 http://anzograph.com/tickit/friend http://anzograph.com/tickit/person2

To find all of the triples that reference person2, the following example query returns all of the triples where person2 is the subject or object:

SELECT ?s ?p ?o FROM http://anzograph.com/tickit WHERE { { BIND (http://anzograph.com/tickit/person2 AS ?s) ?s ?p ?o . } UNION { BIND (http://anzograph.com/tickit/person2 AS ?o) ?s ?p ?o . } }

s | p | o ------------------------------------------+-------------------------------------------------+----------------------------------------- http://anzograph.com/tickit/person2 | http://anzograph.com/tickit/friend | http://anzograph.com/tickit/person49923 http://anzograph.com/tickit/person2 | http://anzograph.com/tickit/friend | http://anzograph.com/tickit/person6671 http://anzograph.com/tickit/person2 | http://anzograph.com/tickit/friend | http://anzograph.com/tickit/person48422 http://anzograph.com/tickit/person2 | http://anzograph.com/tickit/friend | http://anzograph.com/tickit/person32005 http://anzograph.com/tickit/person2 | http://anzograph.com/tickit/friend | http://anzograph.com/tickit/person48156 ... http://anzograph.com/tickit/person2 | http://anzograph.com/tickit/dislike | broadway http://anzograph.com/tickit/person2 | http://anzograph.com/tickit/state | WI http://anzograph.com/tickit/person2 | http://anzograph.com/tickit/city | Murfreesboro http://anzograph.com/tickit/person2 | http://anzograph.com/tickit/like | musicals ... http://anzograph.com/tickit/person32064 | http://anzograph.com/tickit/friend | http://anzograph.com/tickit/person2 http://anzograph.com/tickit/person41654 | http://anzograph.com/tickit/friend | http://anzograph.com/tickit/person2 http://anzograph.com/tickit/person48892 | http://anzograph.com/tickit/friend | http://anzograph.com/tickit/person2 http://anzograph.com/tickit/person6048 | http://anzograph.com/tickit/friend | http://anzograph.com/tickit/person2 http://anzograph.com/tickit/person15323 | http://anzograph.com/tickit/friend | http://anzograph.com/tickit/person2 ... 100 rows

How do I perform a cascaded delete to remove all triples associated with a resource?

The example above demonstrates how to find all of the triples that reference a resource. This example shows how to delete the resource and all of the triples that refer to it. The query below deletes person2 and all associated triples from the tickit graph:

DELETE { GRAPH http://anzograph.com/tickit { ?s ?p ?o . } } WHERE { GRAPH http://anzograph.com/tickit { ?s ?p ?o . filter(?s=http://anzograph.com/tickit/person2 || ?o=http://anzograph.com/tickit/person2) } }

To confirm that person2 and the related triples no longer exist, you can run the query from the first example:

SELECT ?s ?p ?o FROM http://anzograph.com/tickit WHERE { { BIND (http://anzograph.com/tickit/person2 AS ?s) ?s ?p ?o . } UNION { BIND (http://anzograph.com/tickit/person2 AS ?o) ?s ?p ?o . } }

s | p | o --+---+--- 0 rows

How do I delete a predicate and all of its values?

You might need to remove a predicate and all of the associated objects from a graph. For example, the sample Tickit dataset includes person subjects with an ssn predicate whose objects are social security numbers for each person. The following query deletes the ssn predicate and the social security numbers from the tickit graph:

DELETE { GRAPH http://anzograph.com/tickit { ?person http://anzograph.com/tickit/ssn ?ssn . } } WHERE { GRAPH http://anzograph.com/tickit { ?person http://anzograph.com/tickit/ssn ?ssn . } }

Source: https://docs.sw.siemens.com/documentation/external/PL20260518131381558/en-US/html/manage-data.htm · retrieved 2026-08-23