IN3060/IN4060/INF3580/INF4580 v19
Front Page
UNIVERSITY OF OSLO
Faculty of Mathematics and Natural Sciences
Examination in IN3060/IN4060
Day of examination: 7 June 2019 Examination hours: 9:00–13:00 Place: Sal 3D Silurveien 2
Permitted aids: All written material
The exam consists of 5 sections with equal weight.
In multiple choice questions 1b, 3h and 3i, you get a negative score for wrong answers, but never less than 0 for the whole question. In question 1c, you get 0 for a wrong answer. In questions 4g to 4k, you only obtain points if all answers in each question are correct.
Section 1: RDF and SHACL
Section 1: RDF and SHACL
1/31 IN3060/IN4060/INF3580/INF4580 v19
1(a) RDF and Turtle
Consider the following triples in Turtle notation:
@prefix rdf:
world:Oslo a world:City ; world:hasMayor [foaf:name "Marianne Borgen"; foaf:gender "female"]; world:isCityInCountry world:Norway . world:Norway a world:Country ; world:hasCapital world:Oslo ; world:hasPopulation "5258000"^^xsd:int ; world:hasName "Norway"@en , "Norge"@no .
How many triples are these?
How many of these triples have a blank node as subject?
How many of these triples have a blank node as object?
How many of these triples have an IRI reference as object?
How many of these triples have an object of datatype xsd:string?
Maximum marks: 5
2/31 IN3060/IN4060/INF3580/INF4580 v19
1(b) RDF data model
In this question, right answers give 0.5 points, wrong answers give -0.5 points, but with a minumim total score of 0.
Assume we have the following defined prefixes:
@prefix rdf:
Is the statement a valid triple in the Turtle serialization?
No Yes
"Milano"@it .
_:a _:a _:a .
[ [] [] ] .
:Paris, :Oslo rdf:type geo:City .
:a :a :a .
:NewYork :hasPopulation 8600000 .
:Oslo rdf:type :Oslo .
[ a :Box] .
"Paris"^^geo:Place a geo:Place .
:Oslo :sameAs "Oslo"^^geo:Place .
Maximum marks: 5
3/31 IN3060/IN4060/INF3580/INF4580 v19
1(c) SHACL vs. OWL
Can SHACL and a validator be used to detect (some) inconsistent information in an RDF graph? (e.g. detect if a dataset gives two different personal ID numbers for a person, more than two parents, etc.)
Select one alternative:
Yes
No
Can OWL and a reasoner be used to detect (some) inconsistent information in an RDF graph? (e.g. detect if a dataset gives two different personal ID numbers for a person, more than two parents, etc.) Select an alternative
Yes
No
Can SHACL and a validator be used to detect (some) missing information in an RDF graph? (e.g. the personal ID number of a person in the dataset is missing) Select an alternative
Yes
No
Can OWL and a reasoner be used to detect (some) missing information in an RDF graph? (e.g. the personal ID number of a person in the dataset is missing) Select an alternative
Yes
No
Can SHACL and a validator be used to infer (some) implicit information in an RDF graph? (e.g. add information about a person’s uncles, based on information about brothers and parents) Select an alternative
Yes
No
Can OWL and a reasoner be used to infer (some) implicit information in an RDF graph? (e.g. add information about a person’s uncles, based on information about brothers and parents) Select an alternative
Yes
No
Maximum marks: 6
4/31 IN3060/IN4060/INF3580/INF4580 v19
1(d) SHACL validation
Given the following SHACL shape @prefix world:
world:CityShape a sh:NodeShape; sh:targetClass world:City; sh:property [ sh:path world:isCityInCountry ; sh:minCount 1; sh:maxCount 1; sh:nodeKind sh:IRI ; sh:class world:Country ; ] . And the following data: :Paris a world:City ; world:hasName "Paris"@fr ; world:isCityInCountry :France . :France world:hasName "France"@fr . There will be an error when validating the RDF graph with respect to the SHACL shape.
a) Explain why there is a validation error, and how the error can be fixed. Skriv tekst her
b) Could it be fixed by adding an rdfs:range statement for world:isCityInCountry? Fill in your answer here
Maximum marks: 4
Section 2: SPARQL
Section 2: SPARQL
In this section, you can use the following namespaces:
bank - http://bank.example.org/ person - http://person.example.org/ xsd - http://www.w3.org/2001/XMLSchema# foaf - http://xmlns.com/foaf/ rdfs - http://www.w3.org/2000/01/rdf-schema# rdf - http://www.w3.org/1999/02/22-rdf-syntax-ns#
and the following RDFS classes and properties:
bank:Bank - The class of all banks. foaf:Person - The class of persons, e.g. bank customers.
5/31 IN3060/IN4060/INF3580/INF4580 v19 bank:Account - The class of all bank accounts bank:Balance - The class of all balances. A balance gives an amount of money for some bank account at a specific point in time. bank:Transaction - The class of all transactions. A transaction moves an amount of money from one account to another, and it is accompanied by a text describing the transaction
bank:accountAtBank - relationship between an account and the bank managing it. bank:accountHolder - relationship between an account and the customer it belongs to. bank:accountNumber - the bank account number of an account. bank:hasBalance - relationship between an account and its balance at some point in time. This should have type xsd:decimal bank:amount - relationship between a balance or transaction, and the amount of money. bank:date - relationship between a balance or transaction, and its xsd:dateTime. bank:fromAccount - relationship between a transaction and the account money is coming from bank:toAccount - relationship between a transaction and the account money is going to bank:text - relationship betwee a transaction and it’s comment text foaf:name - Relationship between something/someone (customer, bank) and a string denoting its name
Below are some example triples:
bank:DLB a bank:Bank ; foaf:name "Drømmeland Banken" .
person:peter a foaf:Person ; foaf:name "Peter Pan" . person:hook a foaf:Person ; foaf:name "Captain Hook" .
bank:dsb10001 a bank:Account ; bank:accountAtBank bank:DSB ; bank:accountHolder person:peter ; bank:accountNumber 10001 ; bank:hasBalance [ a bank:Balance ; bank:amount "12345.67"^^xsd:decimal ; bank:date "2010-01-01T00:00:00"^^xsd:dateTime ] .
bank:dsb10002 a bank:Account ; bank:accountAtBank bank:DSB ; bank:accountHolder person:hook ; bank:accountNumber 10002 ; bank:hasBalance [ a bank:Balance ; bank:amount "765432.10"^^xsd:decimal ; bank:date "2010-01-01T00:00:00"^^xsd:dateTime ] .
[] a bank:Transaction ; bank:toAccount bank:dsb10002 ; bank:fromAccount bank:dsb10001 ; bank:date "2010-01-02T09:00:00"^^xsd:dateTime ; bank:amount "1000.00"^^xsd:decimal ; bank:text "For flying lessons" .
[] a bank:Transaction ; bank:toAccount bank:dsb10001 ; bank:fromAccount bank:dsb10002 ; bank:date "2010-01-03T09:00:00"^^xsd:dateTime ; bank:amount "500.00"^^xsd:decimal ; bank:text "Loan of hook" .
6/31 IN3060/IN4060/INF3580/INF4580 v19
2(a) Accounts and Account holders
Write a SPARQL query that lists the bank account number of every account in bank:DLB, and the name of its holder
Fill in your answer here
1
Maximum marks: 4
7/31 IN3060/IN4060/INF3580/INF4580 v19
2(b) Conflicting Balances
Write a SPARQL query that finds accounts that have balances giving different amounts of money at the same point in time. Print the account number and the dateTime.
Fill in your answer here
1
Maximum marks: 4
8/31 IN3060/IN4060/INF3580/INF4580 v19
2(c) Account statement
Write a SPARQL query that lists all transactions going in or out of the account dlb:10001. Your output should have three columns:
the dateTime of the transaction the amount in (empty when the transaction goes out from the account) the amount out (empty when the transaction goes into the acount)
when in out 2010-01-02T09:00:00 1000.00 2010-01-03T09:00:00 500.00
Fill in your answer here
1
Maximum marks: 4
9/31 IN3060/IN4060/INF3580/INF4580 v19
2(d) Accounts with high inflow
Write a SPARQL query that lists the total amount going into any account in 2010, provided this total is over 100000. The output should have two columns, the account number and the sum of incoming amounts.
You can assume that different accounts have different account numbers.
Fill in your answer here
1
Maximum marks: 4
10/31 IN3060/IN4060/INF3580/INF4580 v19
2(e) Unused accounts
Write a SPARL query that lists the number and account holder of every account that have not been involved in any transactions during 2018. Fill in your answer here
1
Maximum marks: 4
11/31 IN3060/IN4060/INF3580/INF4580 v19
Section 3: RDFS Inference
Section 3: RDFS Inferences
Assume we have the following prefixes:
@prefix rdf:
and let be the following set of (turtle) triples describing bicycles and the main components a bicycle is made of: frame, wheels and so-called group, which includes brakes, bottom bracket, derailleurs, hubs and shifters.
(1) :Frame rdfs:subClassOf :BicyclePart . (2) :Wheel rdfs:subClassOf :BicyclePart . (3) :Group rdfs:subClassOf :BicyclePart . (4) :Brake rdfs:subClassOf :BicyclePart .
(5) :hasFrame rdfs:domain :Bicycle (6) :hasFrame rdfs:range :Frame
(7) :hasGroup rdfs:domain :Bicycle (8) :hasGroup rdfs:range :Group
(9) :hasFrame rdfs:subPropertyOf :hasPart (10) :hasGroup rdfs:subPropertyOf :hasPart
(11) :isFrameOf rdfs:domain :Frame . (12) :isFrameOf rdfs:range :Bicycle .
(13) :Nakamura_Grade_4:hasFrame :AluminumFrame (14) :Nakamura_Grade_4:hasGroup :Deore
(15) :Cannondale_F1000 :hasFrame :CarbonFrame (16) :Cannondale_F1000 :hasGroup :XTR
You can use the numbers in the leftmost column to reference the triples in your derivations in the following exercises.
12/31 IN3060/IN4060/INF3580/INF4580 v19
3(a) Class of Brake
For the triple
:Brake r dfs:subClass O f : BicyclePart .
either give a derivation from using the rules of RDFS and simple entailment or explain why this is not possible if no such derivation exists.
Fill in your answer here
Words: 0
Maximum marks: 2
13/31 IN3060/IN4060/INF3580/INF4580 v19
3(b) Parts of Cannondale
For the triple
:Cannondale_F10 0 0 : h asPart _:p .
either give a derivation from using the rules of RDFS and simple entailment or explain why this is not possible if no such derivation exists.
Fill in your answer here
Words: 0
Maximum marks: 3
14/31 IN3060/IN4060/INF3580/INF4580 v19
3(c) Type of Nakamura
For the triple
:Nakamura_ Grade_4 rdf:type :Bicycle .
either give a derivation from using the rules of RDFS and simple entailment or explain why this is not possible if no such derivation exists.
Fill in your answer here
Words: 0
Maximum marks: 2
15/31 IN3060/IN4060/INF3580/INF4580 v19
3(d) Range of hasPart
For the triple
:hasPart rdfs:range :BicyclePart
either give a derivation from using the rules of RDFS and simple entailment or explain why this is not possible if no such derivation exists.
Fill in your answer here
Words: 0
Maximum marks: 2
16/31 IN3060/IN4060/INF3580/INF4580 v19
3(e) Type of XTR
For the triple
:XTR a :BicyclePart .
either give a derivation from using the rules of RDFS and simple entailment or explain why this is not possible if no such derivation exists.
Fill in your answer here
Words: 0
Maximum marks: 3
17/31 IN3060/IN4060/INF3580/INF4580 v19
3(f) Entailment versus Derivability
Give an example of a triple that is entailed by (1) to (16), but cannot be derived by the RDFS and simple entailment rules.
Fill in your answer here
Words: 0
Maximum marks: 2
18/31 IN3060/IN4060/INF3580/INF4580 v19
3(g) hasFrame versus isFrameOf
Intuitively, when a bicycle has a certain frame, then this frame is a frame of that bicycle. Is it possible in RDFS to specify this relationship between :hasFrame and :isFrameOf? Are there any other ways to describe this relationship, e.g., in another language?
Fill in your answer here
Words: 0
Maximum marks: 2
19/31 IN3060/IN4060/INF3580/INF4580 v19
3(h) Limitations and Complexity of RDFS
Are the following statements true or false. Tick the correct answer.
RDFS reasoning uses the "open world assumption" (OWA)?
True
False
Are there RDFS graphs that are not consistent?
Yes
No
Can you express the fact that two classes are disjoint in an RDFS graph?
Yes
No
There is currently no known algorithm that decides RDFS entailment in polynomial time.
True
False
Maximum marks: 2
20/31 IN3060/IN4060/INF3580/INF4580 v19
3(i) Soundness and Completeness
Given a language with a notion of entailment (like RDFS or OWL) and a calculus for that language.
If the calculus is sound then every statement that is entailed can be derived.
True
False
If the calculus is complete then every statement that is entailed can be derived.
True
False
If the calculus is sound then every statement that can be derived is entailed.
True
False
If the calculus is complete then every statement that can be derived is entailed.
True
False
Maximum marks: 2
21/31 IN3060/IN4060/INF3580/INF4580 v19
Section 4: Description Logic and OWL
Section 4: Description Logic and OWL
In the following exercises you can use Manchester syntax to write axioms in Description Logic (DL). The conversion between DL syntax and Manchester syntax is given in the following table.
22/31 IN3060/IN4060/INF3580/INF4580 v19
Classes, Properties and Individuals
This is the relevant vocabulary for the following exercises.
Classes:
Person Musician ProfessionalMusician Instrument Orchestra AmateurOrchestra
Properties/roles:
plays owns memberOf
Individuals:
edvard
Musicians and professional musicians are persons who (usually) play an instrument and (usually) also own instruments. Some musicians are also members of orchestras or amateur orchestras.
4(a) Musicians
A musician is precisely a person who plays an instrument.
Specify this statement as DL axiom (use DL or Manchester OWL syntax).
Maximum marks: 2
4(b) Professional Musicians
All professional musicians play at least two instruments and own at least one instrument.
Specify this statement as DL axiom (use DL or Manchester OWL syntax).
Maximum marks: 3
23/31 IN3060/IN4060/INF3580/INF4580 v19
4(c) Orchestras I
Only professional musicians are members of orchestras.
Specify this statement as DL axiom (use DL or Manchester OWL syntax).
Maximum marks: 2
4(d) Amateur Orchestras
All members of an AmateurOrchestra are non-professional musicians. Specify this statement as DL axiom (use DL or Manchester OWL syntax).
Maximum marks: 3
4(e) Orchestras II
All members of orchestras are either professional musicians or persons who play at least three instruments.
Specify this statement as DL axiom (use DL or Manchester OWL syntax).
Maximum marks: 2
4(f) Owning Instruments
A person owns all instruments played by him/her.
You may assume that if x plays y, then x is a person and y an instrument.
Specify this statement as DL axiom (use DL or Manchester OWL syntax).
Maximum marks: 3
24/31 IN3060/IN4060/INF3580/INF4580 v19
4(g) Properties of "is older than"
The relation "is older than" between persons is reflexive
True
False
irreflexive
True
False
symmetric
True
False
asymmetric
True
False
transitive
True
False
Maximum marks: 1
25/31 IN3060/IN4060/INF3580/INF4580 v19
4(h) Properties of "knows"
The relation "knows" between persons is reflexive
True
False
irreflexive
True
False
symmetric
True
False
asymmetric
True
False
transitive
True
False
Maximum marks: 1
26/31 IN3060/IN4060/INF3580/INF4580 v19
4(i) Properties of "is father of"
The relation "is father of" between persons is reflexive
True
False
irreflexive
True
False
symmetric
True
False
asymmetric
True
False
transitive
True
False
Maximum marks: 1
27/31 IN3060/IN4060/INF3580/INF4580 v19
4(j) Properties of "is same age as"
The relation "is same age as" between persons is reflexive
True
False
irreflexive
True
False
symmetric
True
False
asymmetric
True
False
transitive
True
False
Maximum marks: 1
28/31 IN3060/IN4060/INF3580/INF4580 v19
4(k) Properties of "is married to"
The relation "is married to" between persons is reflexive
True
False
irreflexive
True
False
symmetric
True
False
asymmetric
True
False
transitive
True
False
Maximum marks: 1
RDF and OWL semantics
Section 5: RDF and OWL semantics
For writing OWL or DL expressions, please use the Manchester syntax, see the table in Section 4.
29/31 IN3060/IN4060/INF3580/INF4580 v19
5(a) Countermodels
Saying that 3 classes Good, Bad, Ugly are "pairwise disjoint" i.e. that each of them is disjoint with each of the others, is not the same as saying that there is no element that is common to all three. ( )
Show this using a countermodel.
(Hint: if they were the same, then all pairwise disjointness axioms like would be entailed by ) Fill in your answer here
Words: 0
Maximum marks: 10
30/31 IN3060/IN4060/INF3580/INF4580 v19
5(b) Blank nodes and existential restrictions
The triples :peter :hasChild _:c . _:c a :Boy . are logically equivalent to the OWL class membership axiom (:hasChild some :Boy) (:peter) , or in DL syntax:
In other words: an interpretation I satsifies the two triples if and only if it satisfies the OWL axiom.
Prove this fact using the simple DL-semantics from the course, as well as the model semantics for OWL. Fill in your answer here
Words: 0
Maximum marks: 10
31/31