Demo - JD Ontology
Back to current version Restore this version

James Dean: License CreativeCommons by-sa-2.0

James Dean Movies#

The following introduction into RDF/SPARQL was inspired by an example taken from the book:

We slightly modified some notations to be conform with the notations of KnowWE.

The used markups for the definition of the ontology can be only seen in the EDIT mode of this wiki page. Thus, when you want to understand how the definitions work, please move to the EDIT mode or choose "More/View Page Source".

Photo of James Dean: License CreativeCommons by-sa-2.0 / find the original file here.

Defining the knowledge base and package#

We first need to define the namespace, where all elements of the James Dean knowledge base should be located, i.e., jamesDeanMovies.

jamesDeanMovies
Then, we define the knowledge base itself, giving it a name and the namespace it should use.

James Dean Movies (JamesDeanDemo)
1.0 joba A demonstration of the ontology markups in KnowWE.
jamesDeanMovies

Defining a schema#

To connect some RDF instances properly in KnowWE, we first need to define some classes and their properties. The classes can be also defined separately and on different wiki articles.

Classes of the James Dean demo:

Actor Director Movie Woman Man
Some properties to represent who played in which movie and who directed the movies:
ObjectProperty
playedIn
@domain: Actor@range: Movie
ObjectProperty
directedBy
@domain: Movie@range: Director

Defining some characters#

We first define some ontology instances in RDF.

People and Movies#

Mr. Dean himself:

JamesDean
The directors of the Dean movies:

GeorgeStevens FredGuiol EliaKazan NicholasRay
And some actresses of Dean movies:

AnnDoran ElizabethTaylor CarrollBaker JoVanFleet JulieHarris MercedesMcCambridge NatalieWood
And now the three movies of James Dean:

Giant EastOfEden RebelWithoutaCause

Relations to connect the instances#

We now connect the instances defined above by using the turtle markup. When the subject and the predicate of two triples is equal, the you can simply separate the differing objects by commas. See, the playedIn relation for instance.
null
JamesDean
playedIn.:
playedIn::
null
Giant
,
null
EastOfEden
,
null
RebelWithoutaCause
;
rdf.type::
rdf:type::
null
Man
;
null
AnnDoran
playedIn.:
playedIn::
null
RebelWithoutaCause
;
rdf.type::
rdf:type::
null
Woman
;
null
ElizabethTaylor
playedIn.:
playedIn::
null
Giant
;
null
CarrollBaker
playedIn.:
playedIn::
null
Giant
;
rdf.type::
rdf:type::
null
Woman
;
null
JoVanFleet
playedIn.:
playedIn::
null
EastOfEden
;
rdf.type::
rdf:type::
null
Woman
;
null
JulieHarris
playedIn.:
playedIn::
null
EastOfEden
;
rdf.type::
rdf:type::
null
Woman
;
null
MercedesMcCambridge
playedIn.:
playedIn::
null
Giant
;
rdf.type::
rdf:type::
null
Woman
;
null
NatalieWood
playedIn.:
playedIn::
null
RebelWithoutaCause
;
rdf.type::
rdf:type::
null
Woman
;
null
Giant
directedBy.:
directedBy::
null
GeorgeStevens
,
null
FredGuiol
;
null
EastOfEden
directedBy.:
directedBy::
null
EliaKazan
;
null
RebelWithoutaCause
directedBy.:
directedBy::
null
NicholasRay
;

Some first queries#

We now try to retrieve some information, that we before represented as triples. Lets see the actresses that played together with James Dean in a movie. We use the NOT IN filter to omitt the appearance of James Dean himself in the result set. When the result set consists of more than one element, the result is displayed as a table.
No ontology found! The package '' is not used to compile an ontology. Internal error while rendering section: null
Lets see, what directors worked in movies where James Dean played in. When the result set consists of one element, the result is displayed as a list of the element values.
No ontology found! The package '' is not used to compile an ontology. Internal error while rendering section: null

Using labels for a user-friendly appearance#

By now we only have seen the names of the actual instances. In RDF it is also possible to define (language dependent) labels for instances by the property rdfs:label. Please note, that we use general labels for actors and directors, but language dependent labels for the names of movies.

null
JamesDean
rdfs.label::
rdfs:label::
'James Dean'
;
null
AnnDoran
rdfs.label::
rdfs:label::
'Ann Doran'
;
null
ElizabethTaylor
rdfs.label::
rdfs:label::
'Elizabeth Taylor'
;
null
CarrollBaker
rdfs.label::
rdfs:label::
'Carroll Baker'
;
null
JoVanFleet
rdfs.label::
rdfs:label::
'JoVan Fleet'
;
null
JulieHarris
rdfs.label::
rdfs:label::
'Julie Harris'
;
null
MercedesMcCambridge
rdfs.label::
rdfs:label::
'Mercedes McCambridge'
;
null
NatalieWood
rdfs.label::
rdfs:label::
'Natalie Wood '
;
null
Giant
rdfs.label::
rdfs:label::
'Giant'@en
;
rdfs.label::
rdfs:label::
'Giganten'@de
;
null
EastOfEden
rdfs.label::
rdfs:label::
'East Of Eden'@en
;
rdfs.label::
rdfs:label::
'Jenseits von Eden'@de
;
null
RebelWithoutaCause
rdfs.label::
rdfs:label::
'Rebel Without a Cause'@en
;
rdfs.label::
rdfs:label::
'Denn sie wissen nicht, was sie tun'@de
;
We are now able to query the RDF store with the labels, for instance, query all actors and the movies (in english language) they played in.

No ontology found! The package '' is not used to compile an ontology. Internal error while rendering section: null