So once I loaded starwars.ttl I am able to execute a query like:
{
Human{
name
appearsIn{
name
}
}
}
produces nicely:
{
"data": [
{
"name": "Luke Skywalker",
"appearsIn": [
{
"name": "Return of the Jedi"
},
{
"name": "A New Hope"
},
{
"name": "The Empire Strikes Back"
}
]
},
{
"name": "Han Solo",
"appearsIn": [
{
"name": "A New Hope"
},
{
"name": "The Empire Strikes Back"
},
{
"name": "Return of the Jedi"
}
]
},
{
"name": "Leia Organa",
"appearsIn": [
{
"name": "The Empire Strikes Back"
},
{
"name": "A New Hope"
},
{
"name": "Return of the Jedi"
}
]
},
{
"name": "Darth Vader",
"appearsIn": [
{
"name": "Return of the Jedi"
},
{
"name": "A New Hope"
},
{
"name": "The Empire Strikes Back"
}
]
},
{
"name": "Wilhuff Tarkin",
"appearsIn": {
"name": "A New Hope"
}
}
]
}
Now how can I get the inverse - show me all Humans for each episode?
owl:inverseOf is nice but how can use it? Shall I add a few turtle statements to starwars.ttl to define the inverse relation?
The SPARQL endpoint for updating the database with SPARQL Update. The valid Accept types are `application/sparql-update` `or application/x-www-form-urlencoded` . Response is the result of the update operation as text, eg `true` or `false` .
Ok trying to create the inverse relation in JSON-LD per speck at https://w3c.github.io/json-ld-syntax/#reverse-properties. Added @reverse ex:containedIn inside the context - the rest stayed the same. Once I have added the json-ld - there is no triple added - that would say ... owl:reversOf ...
This example is useful - loaded into Stardog - but still trying to figure out the graphql query returning zero rows with reasoning on:
{
ex_children{
name
}
}
That's a good question. I guess that would require creating an owl:inverseOf. I would first check to see if that axiom is being created after importing the json-ld and then if it was make sure that it is contained in a graph, or default graph that Stardog will be using for reasoning. If it's there and in the correct graph it should work.
According to the example you pasted from the spec, Stardog is behaving correctly. You can verify this in the example box by switching it over to Turtle or Statements.
From reading the spec itself, @reverse does not have to do with inferencing/reasoning at all; it is merely a way to define relationships as o -> p -> s instead of s -> p -> o.
If you want to use inferencing to see this relationship, you can define explicit owl:inverseOf relationships in your JSON-LD:
JSON-LD seems to be kind of finicky when it comes to specifying literals versus IRIs, and where you have to do it. I have rewritten your JSON-LD to be what you're looking for by moving the owl:inverseOf definition into the @graph instead of the @context:
You may want to use the CLI stardog graphql explain command to help you out. It will show you the SPARQL query generated by Stardog to fulfill the provided graphql query.