Create your first node
Let's see how to encode the information about ourselfs into a small Knwoledge Graph.
Using rdfs:label
We need a node in the graph representing ourselves, I call it qa:node1
.
And since my name is QAnswer I want to call it like that. rdfs:label
is the standard way to attach a name of a node using Semantic Web Standards.
It is important to give a label to a node. A URI will only be used to generate SPARQL queries if the question contains its label. (see Requirements)
Let's do it:
- Turtle
- UI
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix qa: <http://qanswer.eu/> .
qa:node1 rdfs:label "QAnswer" .
We can already ask "QAnswer?" or "What is QAnswer?" and get:
Using skos:altLabel
You may be called also differently. So let's add this too:
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
qa:node1 skos:altLabel "QAnswer KG" .
qa:node1 skos:altLabel "QA" .
We used another standard property which is skos:altLabel
. And yes, people also call me "QAnswer KG" or "QA" in short.
Now you can also ask "QAnswer KG?" or "What is QA?".
Finally lets add a little hack 🤖. We want to ask also thinks like "Who are you?", "What do you like?" ... so let add to the node also the name "you" 😉
qa:node1 rdfs:label "QAnswer" .
qa:node1 skos:altLabel "QAnswer KG" .
qa:node1 skos:altLabel "QA" .
qa:node1 skos:altLabel "you" .
All together this looks as follows:
- Turtle
- UI
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix qa: <http://qanswer.eu/> .
qa:node1 rdfs:label "QAnswer" .
qa:node1 skos:altLabel "QAnswer KG" .
qa:node1 skos:altLabel "QA" .
qa:node1 skos:altLabel "you" .