Generally, I’m interested how to explore a Dgraph database when you don’t know what is in there. Suppose someone has given you access to a Dgraph instance, what’s the first query you run to start working out what’s in there? Or is GraphQL± not the tool for the job and you should find the schema or get the information out-of-band?
My specific case is I’ve used the Bulk loader to load some RDF and let it construct the schema itself. The RDF looks like:
<http://example.com#literalbagcontainer1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com#THINGY> .
<http://example.com#literalbagcontainer1> <http://example.com#linked_to> "bar" .
<http://example.com#literalbagcontainer1> <http://example.com#linked_to> "foo" .
At this stage, I’ve got a few problems:
- I don’t know if the property name was loaded with the full URI like http://example.com#linked_to or shortened somehow
- if full URIs are used, I can’t figure out how to escape the names in a GraphQL± query. Any queries that use the full URI complain about the : (colon) character. I’ve tried escaping with single quotes, double quotes and backticks but none seem to work. Google queries for “dgraph escape” aren’t yielding anything either.
- I can’t find the generated schema. I’m running in Docker and I’ve done a
docker exec
into the container to look around but can’t find a schema
Solutions to my specific case are appreciated but I’m more interested in the general skill of exploring a Dgraph DB with no prior knowledge. In a relational world I’d get some tables names, describe them then start doing some SELECT *
queries to get a feel for the DB. In other NoSQL DBs there’s typically some wildcard type queries where you can start looking at some data, any data! In GraphQL± I’m stuck, I can’t figure out a SELECT * type query.
I’ve tried guessing at UIDs but no matter what UID I used, I get a response but without any edge names:
{
f(func: uid(0x00)) {
uid
linked_to # here I'm guessing the RDF property was shortened
}
}
Thanks for the help
Tom