R3000
(R3000)
December 8, 2024, 11:16pm
1
Below is a Stardog Explorer screenshot for simplest data. But when visualizing schema - relationships are not shown. Why?
Here is the data with schema ttl:
@prefix ex: <http://example.com/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
# Classes
ex:Person a rdfs:Class ;
rdfs:label "Person" .
ex:Organization a rdfs:Class ;
rdfs:label "Organization" .
# Predicate
ex:worksAt a rdf:Property ;
rdfs:label "works at" ;
rdfs:domain ex:Person ;
rdfs:range ex:Organization .
# Instances
ex:John a ex:Person ;
rdfs:label "John" ;
ex:worksAt ex:Costco .
ex:Jane a ex:Person ;
rdfs:label "Jane" ;
ex:worksAt ex:Walmart .
ex:Costco a ex:Organization ;
rdfs:label "Costco" .
ex:Walmart a ex:Organization ;
rdfs:label "Walmart" .
I have added the ttl using this command:
stardog data add https://sd-***.stardog.cloud:5820/mydb .\easy.ttl -g tag:stardog:api:context:schema -u *** -p ***
stephen
(stephen)
December 9, 2024, 3:05pm
2
Hi Radu,
Your image isn't showing up (at least for me), but I do notice that you're using rdf[s]
classes to define your classes/properties. Try defining your classes as owl:Class
and your predicate as an owl:ObjectProperty
and see if that causes Explorer to find it.
R3000
(R3000)
December 9, 2024, 3:48pm
3
@stephen thanks for your response. Indeed owl fixed graph schema visualization - please see screenshot below. But now instance visualization not working - when I search in Explorer for the following instance - the result is white as snow - nothing!
`http://example.com/John`
My updated easy.ttl is as follows:
@prefix ex: <http://example.com/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
# Classes
ex:Person a owl:Class ;
rdfs:label "Person" .
ex:Organization a owl:Class ;
rdfs:label "Organization" .
# Object Property
ex:worksAt a owl:ObjectProperty ;
rdfs:label "works at" ;
rdfs:domain ex:Person ;
rdfs:range ex:Organization .
# Instances
ex:John a ex:Person ;
rdfs:label "John" ;
ex:worksAt ex:Costco .
ex:Jane a ex:Person ;
rdfs:label "Jane" ;
ex:worksAt ex:Walmart .
ex:Costco a ex:Organization ;
rdfs:label "Costco" .
ex:Walmart a ex:Organization ;
rdfs:label "Walmart" .
stephen
(stephen)
December 9, 2024, 3:56pm
4
Hi Radu,
You're storing your instance data in your schema graph alongside the ontology. If you move those triples somewhere else (e.g., the default graph), you should see the instances show up.
R3000
(R3000)
December 9, 2024, 5:34pm
5
@stephen - that did it - thanks! Below is snapshot of all the instances and classes and relationships.
Now my follow up questions are:
Shall I (or do I also have) to create a new Model in Stardog Studio? How would that help?
In explorer how do I show all classes and instances and relationships between them with one click or one command? I know one can keep "expanding..." but is there a better way to show the entire graph including its schema in Explorer?
Here are my two files:
easy_schema.ttl
@prefix exs: <http://example.com/schema/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
# Classes
exs:Person a owl:Class ;
rdfs:label "Person" .
exs:Organization a owl:Class ;
rdfs:label "Organization" .
# Object Property
exs:worksAt a owl:ObjectProperty ;
rdfs:label "works at" ;
rdfs:domain exs:Person ;
rdfs:range exs:Organization .
and easy_data.ttl
@prefix exg: <http://example.com/graph/> .
@prefix exs: <http://example.com/schema/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
# Instances
exg:John a exs:Person ;
rdfs:label "John" ;
exs:worksAt exg:Costco .
exg:Jane a exs:Person ;
rdfs:label "Jane" ;
exs:worksAt exg:Walmart .
exg:Costco a exs:Organization ;
rdfs:label "Costco" .
exg:Walmart a exs:Organization ;
rdfs:label "Walmart" .
And here is how I added them:
stardog data remove https://sd-***.stardog.cloud:5820/mydb --all -u *** -p ***
stardog data add https://sd-***.stardog.cloud:5820/mydb .\easy_schema.ttl -g tag:stardog:api:context:schema -u *** -p ***
stardog data add https://sd-***.stardog.cloud:5820/mydb .\easy_data.ttl -g tag:stardog:context:default -u *** -p ***