Question 1
Graph Pattern can be combined to form complex (conjunctive) queries for RDF graph traversal.
In SPARQL the keyword UNION allows for alternatives (logical disjunction). But the option given was consecutive SPARQL query patterns are treated as a disjunction. So it was incorrect.
Question 2
Typical SPARQL query comprises of for instance,
prefix declarations
PREFIX hpi: <http://www.hpi-web.de/resource/ >
output variables
SELECT ?book
graph declaration
FROM <http://hpi-web.de/>
query pattern
WHERE {
?author hpi:author ?book .
}
*** query modifiers***
ORDER BY ASC (?book)
Question 3
In SPARQL query blank nodes can be represented as [?p ?o] or [] or _:BlankNode
Regrading The answering option
SELECT ?p WHERE { “ ” ?p ?o . } is also syntactically correct. A good explanation has been given by Avram Colak in the discussion. So actually all answers are correct for this question. People who selected this answering option and got minus points will be regraded. The answering option will be removed.
Question 4
BOUND(A) - Boolean
It returns if a variable is bound to the queried triple, as a boolean
str(A) - Literal
It returns the simple literal of a URI or a literal
lang(A) - Literal
It returns a simple literal of the language tag
isURI(A) - Boolean
It returns, if the queried variable is a URI, as a boolean
isLITERAL(A) - Boolean
It returns, if the queried variable is a literal, as a boolean
Question 5
In this question the union of instances of two classes had to be queried. This can either be done by a SPARQL UNION and every subquery asks for the entities which are type of a certain class. Or by filtering the result set of all entities with a type information for the specified classes. The latter query also permits to have the class information for all queried entities in the result set by printing out ?class. The UNION query can only have the entities in the result set.
SELECT ?s WHERE { ?s a dbo:Person . ?s a dbo:SoccerClub . }
in this case ?s must be of both types
SELECT ?s WHERE { ?s ?p ?o . FILTER({ ?s a dbo:Person } || { ?s a dbo:SoccerClub }) }
This syntax is wrong. The filter expression demands a boolean parameter.
Regrading Due to a typo in the option
SELECT DISTINCT ?s WHERE { ?s a ?class . FILTER ( ?class = dbo:person || ?class = dbo:SoccerClub ) } some people did not select it, because the class dbo:Person was incorrectly capitalized. Of course, capitalization matters! Therefore, all people who did not select this answering option will get the points. The answer will be selected for you. Please don't be surprised when your answer changes.
Question 6
In this question another knowledge base was given in Turtle syntax. The blanks in the SPARQL had to be filled.
First query: Was one of Robert's favorite teams founded before 1900?
1st blank: This query was an ASK query. Therefore the first blank had to be filled with ASK
2nd blank: Here the property for the founding year was missing -> :foundingYear
3rd blank: Here the results of the query where filtered for founding years before 1900 -> FILTER
Question 7
Which teams do Robert AND Sebastian have in common as favorite team?
1st blank: Here the subject of the triple with a favorite team was asked. We already provided :Sebastian, therefore here :Robert had to be
filled in
2nd blank: The object of the property :favoriteTeam is a list. We already provided the variable for the list resource: ?list
3rd blank: Here also the variable for the list resource of Sebastian's favorite teams is asked -> ?list2
Question 8
List the soccer players of the team :VfL1888 and the number of their favorite teams.
1st blank: the query askes for the soccer players. Therefore the property :playsMidfield OR :playsForward should be queried. In SPARQL 1.1 this is done by using a pipe "|" between the properties.
2nd blank: All soccer players of :VfL1888 were asked to be listed - whether they have favorite teams or not. Therefore the OPTIONAL operator had to used for listing the favorite teams for the players.
3rd blank: for counting the amount of teams the GROUP BY operator has to be used over the players (?p)