Sunday, December 14, 2008

Blatt 6

1.
Verwendung von http://dbpedia.org/snorql/

a)

SELECT ?abstract WHERE {
:Albert_Einstein dbpedia2:abstract ?abstract .
FILTER (lang(?abstract) = 'de')
}

abstract
"Albert Einstein (* 14. März 1879 in Ulm; † 18. April 1955 in Princeton, USA) war ein [...] verstand er sich selbst als Pazifist, Sozialist und Zionist."


SELECT ?person WHERE {
:Albert_Einstein dbpedia2:doctoralStudents ?person.
}

[no results]


SELECT ?person WHERE {
:Albert_Einstein dbpedia2:almaMater ?uni.
?person dbpedia2:almaMater ?uni.
FILTER (?person != :Albert_Einstein)
}

person
[...]


erste Variante:

SELECT DISTINCT ?person WHERE {
{
:Albert_Einstein dbpedia2:almaMater ?uni.
?person dbpedia2:almaMater ?uni.
FILTER (?person != :Albert_Einstein)
?person <http://dbpedia.org/ontology/award> :Nobel_Prize_in_Physics.
}
UNION
{
:Albert_Einstein dbpedia2:almaMater ?uni.
?person dbpedia2:almaMater ?uni.
FILTER (?person != :Albert_Einstein)
?person dbpedia2:awards :Nobel_Prize_in_Physics.
}
UNION
{
:Albert_Einstein dbpedia2:almaMater ?uni.
?person dbpedia2:almaMater ?uni.
FILTER (?person != :Albert_Einstein)
?person dbpedia2:prizes :Nobel_Prize_in_Physics.
}
}

person
:Charles_%C3%89douard_Guillaume


zweite Variante:

SELECT DISTINCT ?person WHERE {
:Albert_Einstein dbpedia2:almaMater ?uni.
?person dbpedia2:almaMater ?uni.
FILTER (?person != :Albert_Einstein)
?person skos:subject <http://dbpedia.org/resource/Category:Nobel_laureates_in_Physics>.
}

person
:Charles_%C3%89douard_Guillaume
:Wilhelm_Conrad_R%C3%B6ntgen


b)

SELECT ?person WHERE {
:Star_Trek dbpedia2:origin ?origin.
?origin dbpedia2:starring ?person.
}

person
:DeForest_Kelley
:George_Takei
:James_Doohan
:Leonard_Nimoy
:Nichelle_Nichols
:Walter_Koenig
:William_Shatner


SELECT DISTINCT ?series WHERE {
:Star_Trek dbpedia2:origin ?origin.
?origin dbpedia2:starring ?person.
?series dbpedia2:starring ?person.
FILTER (?series != ?origin)
}

series
[...]


SELECT DISTINCT ?series WHERE {
:Star_Trek dbpedia2:origin ?origin.
?origin dbpedia2:starring ?person.
?series dbpedia2:starring ?person.
FILTER (?series != ?origin)
?series <http://dbpedia.org/ontology/releaseDate> ?date.
FILTER (xsd:date(?date) > xsd:date("1990-12-31"))
}

series
[...]


c)

SELECT ?name ?birth ?death WHERE {
?person dbpedia2:occupation :Scientist.
?person dbpedia2:name ?name.
?person <http://dbpedia.org/ontology/birthdate> ?birth.
?person <http://dbpedia.org/ontology/deathdate> ?death.
}

name birth death
[...]


SELECT ?name WHERE {
{
?person dbpedia2:occupation :Scientist.
?person dbpedia2:name ?name.
?person <http://dbpedia.org/ontology/birthdate> ?birth.
?person <http://dbpedia.org/ontology/deathdate> ?death.
?person <http://dbpedia.org/ontology/deathplace> :Berlin.
FILTER (xsd:date(?death) < xsd:date("1950-01-01"))
}
UNION
{
?person dbpedia2:occupation :Scientist.
?person dbpedia2:name ?name.
?person dbpedia2:dateOfBirth ?birth.
?person dbpedia2:dateOfDeath ?death.
?person dbpedia2:deathPlace :Berlin.
FILTER (xsd:date(?death) < xsd:date("1950-01-01"))
}
}

[no results]


d)

SELECT ?person WHERE {
?person dbpedia2:pseudonym ?pseudonym.
OPTIONAL { ?person dbpedia2:dateOfDeath ?date }.
FILTER (!bound(?date))
OPTIONAL { ?person dbpedia2:deathDate ?date2 }.
FILTER (!bound(?date2))
OPTIONAL { ?person dbpedia2:deathPlace ?place }.
FILTER (!bound(?place))
OPTIONAL { ?person <http://dbpedia.org/ontology/deathdate> ?date3 }.
FILTER (!bound(?date3))
OPTIONAL { ?person <http://dbpedia.org/ontology/deathplace> ?place2 }.
FILTER (!bound(?place2))
}

person
[...]


2.

a)

PREFIX ex: <http://example.org/>
SELECT ?objekt WHERE {
{
ex:Sonne ex:satellit ?objekt.
}
UNION
{
ex:Sonne ex:satellit ?satellit.
?satellit ex:satellit ?objekt.
}
}


b)

PREFIX ex: <http://example.org/>
SELECT ?objekt ?oberobjekt WHERE {
?objekt ex:radius ?radius.
FILTER (?radius * ?radius * ?radius * 4 / 3 > 20000000000)
?oberobjekt ex:satellit ?objekt.
}


c)

PREFIX ex: <http://example.org/>
SELECT ?objekt WHERE {
?objekt ex:name ?name.
FILTER (lang(?name) = 'en')
?oberobjekt ex:satellit ?objekt.
?oberobjekt ex:radius ?radius.
FILTER (?radius > 3000)
}


3.

-teils Umsetzung durch ein Programm
-Probleme und deshalb durch manuelle Erledigung:
*das Finden aller tatsächlich relevanten Hyperlinks; Ausgabe aller potenziell relevanter Hyperlinks; entsprechendes Auslassen der irrelevanten Hyperlinks
*einige Objekte besitzen mehrere Properties (z.B. dbpedia:Denmark ist ein Objekt der Properties p:birthPlace und p:nationality); Erschließung aus dem Kontext, welche Property passend ist
*daraus ergibt sich das Problem, dass in bestimmten Kontexten keine passende Property existiert (z.B. Textpassage, in der es um seinen Vater und den dänischen König geht)

-Reduzierung des Quelltextes auf die Links mit entsprechenden Annotationen und der Definition des Namespaces für die verwendeten Properties aus der DBPedia

<div id="globalWrapper" xmlns:p="http://dbpedia.org/property/">

<a rel="p:birthPlace" href="/w/index.php?title=Knutstorp_Castle&action=edit&redlink=1" class="new" title="Knutstorp Castle (page does not exist)">Knutstorp Castle</a>
<a rel="p:birthPlace" href="/wiki/Scania" title="Scania">Scania</a>
<a rel="p:birthPlace" href="/wiki/Denmark" title="Denmark">Denmark</a>
<a rel="p:birthPlace" href="/wiki/Sweden" title="Sweden">Sweden</a>
<a rel="p:dateOfDeath" href="/wiki/October_24" title="October 24">24 October</a>
<a rel="p:deathPlace" href="/wiki/Prague" title="Prague">Prague</a>
<a rel="p:nationality" href="/wiki/Denmark" title="Denmark">Danish</a>
<a rel="p:occupation" href="/wiki/Nobility" title="Nobility">Nobleman</a>
<a rel="p:occupation" href="/wiki/Astronomy" title="Astronomy">Astronomer</a>
<a rel="p:parents" href="/wiki/Otte_Brahe" title="Otte Brahe">Otte Brahe</a>
<a rel="p:parents" href="/w/index.php?title=Beate_Bille&action=edit&redlink=1" class="new" title="Beate Bille (page does not exist)">Beate Bille</a>
<a rel="p:deathPlace" href="/wiki/Prague" title="Prague">Prague</a>
<a rel="p:birthPlace" href="/w/index.php?title=Knutstorp_Castle&action=edit&redlink=1" class="new" title="Knutstorp Castle (page does not exist)">Knutstorp Castle</a>
<a rel="p:dateOfDeath" href="/wiki/October_24" title="October 24">24 October</a>
<a rel="p:deathPlace" href="/wiki/Prague" title="Prague">Prague</a>
<a rel="p:nationality" href="/wiki/Denmark" title="Denmark">Danish</a>
<a rel="p:occupation" href="/wiki/Nobility" title="Nobility">nobleman</a>
<a rel="p:occupation" href="/wiki/Astronomy" title="Astronomy">astronomical and planetary</a>
<a rel="p:birthPlace" href="/wiki/Sk%C3%A5neland" title="Skåneland">Scania</a>
<a rel="p:occupation" href="/wiki/Astronomy" title="Astronomy">astronomer</a>
<a rel="p:birthPlace" href="/w/index.php?title=Knutstorp_Castle&action=edit&redlink=1" class="new" title="Knutstorp Castle (page does not exist)">Knutstorp Castle</a>
<a rel="p:birthPlace" href="/wiki/Scania" title="Scania">Scania</a>
<a rel="p:parents" href="/wiki/Otte_Brahe" title="Otte Brahe">Otte Brahe</a>
<a rel="p:parents" href="/w/index.php?title=Beate_Bille&action=edit&redlink=1" class="new" title="Beate Bille (page does not exist)">Beate Bille</a>
<a rel="p:nationality" href="/wiki/Denmark" title="Denmark">Danish</a>
<a rel="p:occupation" href="/wiki/Astronomy" title="Astronomy">astronomy</a>
<a rel="p:birthPlace" href="/wiki/Denmark" title="Denmark">Denmark</a>
<a rel="p:dateOfDeath" href="/wiki/October_24" title="October 24">24 October</a>
<a rel="p:deathPlace" href="/wiki/Prague" title="Prague">Prague</a>
<a rel="p:deathPlace" href="/wiki/Prague" title="Prague">Prague</a>

</div>

No comments: