The tutorial focuses on scholars, who want to acquaint themselves with a low threshold
— generic, simple yet powerful, and explorative — workflow of modelling, extracting, processing (queries, visualizations), and publishing of structured data
(LOD, Semantic Web) from heterogeneous XML-sources by means of XPath. The instructors assume basic acquaintance with XML and XPath (both will be quickly revised, cheat sheets
will be provided).
Triple-Statement-Extraction from heterogeneous XML-Resources, Basic-Research-Workflow (Statement-Formulation, Statement-Extraction, Triple-Store-Import, SPARQL-Querying, Visualization).
<S:Thomas> <P:Loves> <O:Epigraphy>/// thus notated with //node1/node2[ ]@Attribute//node[@Attribute="Value"]tei:placeNamePlease download and open the file sturm_persons.xml. And query
- all
xml:ids ofpersons,- all
persons that have a@sourceattribute,- all
persons that have a@sourceattribute with aGND-URLas value.
Please check the XPath handout & use the XPath functions.
vocabularies brackets all URI namespaces and binds them to prefixes.triples brackets all statements built with
condition element ⇨ must be an evaluable XPath expressionsubject element ⇨ must be a URI (or blank node)predicate element ⇨ must be a URIobject element ⇨ must be a URI, Literal (or blank node).collection brackets all XML resources which will be crawled.
Please open the configuration file sturm_config_works_xtriples.xml.
Drawing all entities and their relationships as circles and arrows representing nodes and edges may help to conceptualize the abstract network of relationships we want to extract from our sources more clearly and subsequently project on an common abstract metadata layer.
Please download and open the file sturm_config_works_xtriples.xml. Use the file to extract the first triples. To do this set the output format to XTriples (for debugging).
Use the XTriples config files in the repository and extract the RDF statements.
Upload the RDF files to the Triple Store.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?letter ?letterlabel
WHERE
{
?letter rdfs:label ?letterlabel .
}
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sturm: <https://xtriples.lod.academy/sturm/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?letter ?letterlabel ?mentiontypelabel ?gender
WHERE
{
?letter sturm:mentions ?mention .
?letter rdfs:label ?letterlabel .
?mention rdf:type ?mentiontype .
?mentiontype rdfs:label ?mentiontypelabel .
Optional {
?mention rdf:type foaf:Person .
?mention foaf:gender ?gender .
}
}
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix sturm: <https://xtriples.lod.academy/sturm/>
SELECT ?letterlabel ?desc ?long ?lat ?place
WHERE
{
?letter rdfs:label ?letterlabel .
…
OPTIONAL {
?sender sturm:sends ?letter .
?letter rdfs:label ?letterlabel .
?letter rdf:type ?lettertype .
?lettertype rdfs:label ?lettertypelabel .
?sender rdfs:label ?sendername .
BIND(concat(str(?lettertypelabel),
" ",
str(?letterlabel),
" sent from ",
str(?sendername)) as ?desc) .
}
…
}