SlideShare uma empresa Scribd logo
1 de 52
Baixar para ler offline
WWW 2012 Tutorial


Schema Mapping with SPARQL 1.1

           Andreas Schultz
        (Freie Universität Berlin)
Outline

   Why Do We Want to Integrate Data?
   Schema Mapping
   Translating RDF Data with SPARQL 1.1
   Mapping Patterns
Motivation

   Web of Data is heterogeneous
   Many different and overlapping ways to
    represent information




               Distribution of the most widely used vocabularies
Data is represented...

    Using terms from a wide range of vocabularies
    Using diverging structures
    With values of different (data type) formats
    Fine grained vs. coarse grained
    Using different measuring units
Naming Differences



  SELECT ?longTrack ?runtime
  {
    {

       ?longTrack mo:duration ?time

      } UNION {

       ?longTrack dbpedia-owl:runtime ?time

      }
      FILTER (?track > 300)
  }
Structural Differences


  dbpedia:Three_Little_Birds
      dbpedia-owl:musicalArtist
          dbpedia:Bob_Marley_&_The_Wailers .




  dbpedia:Bob_Marley_&_The_Wailers
      foaf:made
          dbpedia:Three_Little_Birds .
Value Level Differences

   “2012-04-15” vs. “2012-04-15”^^xsd:date
   “John Doe” vs. “John Doe”@en
   20 in Celcius vs. 68 in Fahrenheit
   “Doe, John” vs. “John Doe”
Outline

   Motivation
   Schema Mapping
   Translating RDF Data with SPARQL 1.1
   Mapping Patterns
Schema Mapping


               For data translation:

  A mapping specifies how data under a source
      representation is translated to a target
representation, that is, the representation that you
           or your application expects.
Ways to Express Executable
Mappings for RDF Data
   Ontology constructs
       OWL, RDFS (rdfs:subClassOf, rdfs:subPropertyOf)
   Rules
       SWRL
       RIF
   Query Languages
       SPARQL 1.1
Outline

   Motivation
   Schema Mapping
   Translating RDF Data with SPARQL 1.1
   Mapping Patterns
Data Translation with SPARQL 1.1

   Nearly W3C Recommendation status
   Many scalable SPARQL engine
    implementations out there
   Data translation with SPARQL CONSTRUCT
   Huge improvements to version 1.0 regarding
    data translation
How to Use SPARQL Construct
Mappings Ideally


 SELECT ?longTrack ?runtime
 FROM {
   Construct {
     ?subj target:relevantProperty ?obj
   } WHERE {
     ?subj sour:relProperty ?obj
   }
 } WHERE {
   ?subj target:relevantProperty ?obj .
   …
 }
How to Use SPARQL Construct
Mappings in Practice


 SELECT ?longTrack ?runtime
 FROM {
   Construct {
     ?subj target:relevantProperty ?obj
   } WHERE {
     ?subj sour:relProperty ?obj
   }
 } WHERE {
   ?subj target:relevantProperty ?obj .
   …
 }
Possibilities

   Execute all SPARQL Construct queries on the
    source data set(s) to generate local versions of
    the target data set(s)
   Optionally merge multiple target data sets into
    one
   Reference these files in FROM clause
   Possibility we won't cover: Write the results
    directly into a RDF store and query the store.
1. Transform Data Sets with ARQ


 query –query=constructQuery.qry –data=sourceDataset.nt > targetDataset.ttl

 # Execute more queries

 …
2. Use Target Data Set Files in Query



  SELECT ?longTrack ?runtime
  FROM <targetDataset.ttl>
  FROM …
  WHERE {
    ?subj target:relevantProperty ?obj .
    …
  }
Outline

   Motivation
   Schema Mapping
   Translating RDF Data with SPARQL 1.1
   Mapping Patterns
Pattern based approach


   Presentation of common mapping patterns
   Ordered from common to not so common
   Learn how to tackle these mapping patterns
    with SPARQL 1.1
Simple Renaming Mapping Patterns
Rename Class / Property

  Substitute the class or property URI


 src:inst   a   dbpedia-owl:MusicalArtist




 src:inst   a   mo:MusicArtist
Rename Class

    SPARQL Mapping:


CONSTRUCT {

    ?s a mo:MusicArtist

} WHERE {

    ?s a dbpedia-owl:MusicalArtist

}
Rename Property

    SPARQL Mapping:


CONSTRUCT {

    ?s rdfs:label ?o

} WHERE {

    ?s freebase:type.object.name   ?o

}
Structural Mapping Patterns
Rename Class based on Property
Existence
  Rename class based on the existence of a
  property relation.

 dbpedia:William_Shakespeare a dbpedia-owl:Person ;
      dbpedia-owl:deathDate "1616-04-23"^^xsd:date .




 dbpedia:William_Shakespeare
      a fb:people.deceased_person .
Rename Class based on Property

     SPARQL Mapping:


 CONSTRUCT {

     ?s   a   freebase:people.deceased_person

 } WHERE {

     ?s   a dbpedia-owl:Person ;
          dbpedia-owl:deathDate ?dd .

 }
Rename Class based on Value

  Instances of the source class become instances of the
  target class if they have a specific property value.

 gw-p:Kurt_Joachim_Lauk_euParliament_1840_P a gw:Person ;
                 gw:profession "politician"^^xsd:string .




 gw-p:Kurt_Joachim_Lauk_euParliament_1840_P ;
                 a fb:government.politician .
Rename Class based on Value

     SPARQL Mapping:


 CONSTRUCT {

     ?s   a   fb:government.politician

 } WHERE {

     ?s a gw:Person ;
        gw:profession "politician"^^xsd:string .

 }
Reverse Property

  The target property represents the reverse
  relationship regarding the source property.

 dbpedia:Queens_of_the_Stone_Age dbpedia-owl:currentMember
           dbpedia:Joey_Castillo .




 dbpedia:Joey_Castillo mo:member_of
           dbpedia:Queens_of_the_Stone_Age .
Reverse Property

     SPARQL Mapping:


 CONSTRUCT {

     ?s   mo:member_of   ?o

 } WHERE {

     ?o   dbpedia-owl:currentMember   ?s

 }
Resourcesify

  Represent an attribute by a newly created
  resource that then carries the attribute value.

 dbpedia:The_Usual_Suspects
             dbpedia-owl:runtime 6360.0 .




 dbpedia:The_Usual_Suspects po:version      _:new .
 _:new po:duration 6360.0 .
Resourcesify

     SPARQL Mapping:


 CONSTRUCT {

     ?s             po:version    _:newversion .
     _:newversion   po:runtime    ?runtime .

 } WHERE {

     ?s   dbpedia-owl:runtime    ?runtime .

 }
Deresourcesify

  Inverse pattern to the Resourcesify pattern.


 dbpedia:John_F._Kennedy_International_Airport
            dbpedia-owl:city dbpedia:New_York_City .
 dbpedia:New_York_City rdfs:label "New York City" .




 dbpedia:John_F._Kennedy_International_Airport
            lgdp:owner "New York City" .
Deresourcesify

     SPARQL Mapping:


 CONSTRUCT {

     ?s   lgdp:owner   ?cityLabel .

 } WHERE {

     ?s dbpedia-owl:city ?city .
     ?city rdfs:label ?cityLabel .

 }
Value Transformation based Mapping Patterns
SPARQL 1.1 functions

    SPARQL 1.1 offers functions covering:

   RDF terms (str, lang, IRI, STRDT etc.)
   Strings     (SUBSTR, UCASE etc.)
   Numerics    (abs, round etc.)
   Dates and Times (now, year, month etc.)
   Hash Functions     (SHA1, MD5 etc.)
   XPath Constructor Functions (xsd:float etc.)
Transform Value 1:1

  Transform the (lexical) value of a property.


 dbpedia:The_Shining_(film)
    dbpedia-owl:runtime 8520 .




 dbpedia:The_Shining_(film)
     movie:runtime 142 .
Transform Value 1:1

      SPARQL Mapping:


  CONSTRUCT {

      ?s   movie:runtime    ?runtimeInMinutes .

  } WHERE {

      ?s dbpedia-owl:runtime ?runtime .
      BIND(?runtime / 60 As ?runtimeInMinutes)

  }



BIND( Expression As ?newVariable )
Transform Literal to URI

  Transform a literal value into a URI.


 dbpedia:Von_Willebrand_disease
    dbpedia-owl:omim 193400 .




                                    Also 1:1 transformation pattern!



 dbpedia:Von_Willebrand_disease
   diseasome:omim <http://bio2rdf.org/omim:193400> .
Transform Literal to URI

     SPARQL Mapping:


 CONSTRUCT {

     ?s   diseasome:omim   ?omimuri .

 } WHERE {

     ?s dbpedia-owl:omim ?omim .
     BIND(IRI(concat(“http://bio2rdf.org/omim:”, str(?omim)))
           As ?omimuri)

 }
Construct Literals

    SPARQL 1.1 offers several functions to
    construct literals:

   STR – returns the lexical form → plain literal
   STRDT – construct data type literal
   STRLANG – construct literal with language tag
Cast to another Datatype


fb:en.clint_eastwood
   fb:people.person.date_of_birth
       “1930-05-31T00:00:00”^^xsd:dateTime .




fb:en.clint_eastwood
    dbpedia-owl:birthDate
       “1930-05-31”^^xsd:date .
Cast to another Datatype

     SPARQL Mapping:


 CONSTRUCT {

     ?s   dbpedia-owl:birthDate   ?date

 } WHERE {

     ?s fb:people.person.date_of_birth    ?dateTime .
     BIND(xsd:date(?dateTime) As ?date)

 }
Transform Value N:1

  Transform multiple values from different
  properties to a single value.

 dbpedia:William_Shakespeare
    foaf:givenName   "William" ;
    foaf:surname     "Shakespeare" .




 dbpedia:William_Shakespeare
     foaf:name       "Shakespeare, William" .
Transform Value N:1

     SPARQL Mapping:


 CONSTRUCT {

     ?s   foaf:name   ?name

 } WHERE {

     ?s   foaf:givenName  ?givenName ;
          foaf:surname    ?surname .
     BIND(CONCAT(?surname, “, ”, ?givenName) As ?name)

 }
Aggregation based Mapping Pattern
Aggregation

  Aggregate multiple values / occurrences into
  one value.

 fb:en.berlin_u-bahn
   fb:metropolitan_transit.transit_system.transit_lines fb:en.u1 ;
   fb:metropolitan_transit.transit_system.transit_lines fb:en.u3 .




 fb:en.berlin_u-bahn
     dbpedia-owl:numberOfLines 2 .
Aggregation

     SPARQL Mapping:


 CONSTRUCT {

     ?s   dbpedia-owl:numberOfLines   ?nrOfLines

 } WHERE {

     { SELECT ?s (COUNT(?l) AS ?nrOfLines) {
         ?s fb:metropolitan_transit.transit_system.transit_lines ?l .
       }
       GROUP BY ?s
     }
 }
Data Cleaning
Data Cleaning

  Integrating data cleaning into a mapping.

 fb:en.jimi_hendrix   fb:people.person.date_of_birth "1942-11-27" .

 fb:en.josh_wink      fb:people.person.date_of_birth "1970" .




 fb:en.jimi_hendrix   dbpedia-owl:birthDate   "1942-11-27"^^xsd:date
Data Cleaning

     SPARQL Mapping:


 Construct {

     ?s dbpedia-owl:birthDate ?birthDate

 } Where {

     ?s fb:people.person.date_of_birth ?bd .
     FILTER regex(?bd, “[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]”)
     BIND ((xsd:date(?bd)) As ?birthDate)

 }
Questions?

Mais conteúdo relacionado

Mais procurados

An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQLOlaf Hartig
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and SemanticsTatiana Al-Chueyr
 
SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)andyseaborne
 
WebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaWebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaKatrien Verbert
 
Querying Linked Data with SPARQL
Querying Linked Data with SPARQLQuerying Linked Data with SPARQL
Querying Linked Data with SPARQLOlaf Hartig
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphsandyseaborne
 
RDF Tutorial - SPARQL 20091031
RDF Tutorial - SPARQL 20091031RDF Tutorial - SPARQL 20091031
RDF Tutorial - SPARQL 20091031kwangsub kim
 
The Semantics of SPARQL
The Semantics of SPARQLThe Semantics of SPARQL
The Semantics of SPARQLOlaf Hartig
 
Federation and Navigation in SPARQL 1.1
Federation and Navigation in SPARQL 1.1Federation and Navigation in SPARQL 1.1
Federation and Navigation in SPARQL 1.1net2-project
 
NoSQL and Triple Stores
NoSQL and Triple StoresNoSQL and Triple Stores
NoSQL and Triple Storesandyseaborne
 
Advance Scala - Oleg Mürk
Advance Scala - Oleg MürkAdvance Scala - Oleg Mürk
Advance Scala - Oleg MürkPlanet OS
 

Mais procurados (20)

An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQL
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and Semantics
 
SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)
 
WebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaWebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPedia
 
SPARQL Tutorial
SPARQL TutorialSPARQL Tutorial
SPARQL Tutorial
 
Querying Linked Data with SPARQL
Querying Linked Data with SPARQLQuerying Linked Data with SPARQL
Querying Linked Data with SPARQL
 
4 sw architectures and sparql
4 sw architectures and sparql4 sw architectures and sparql
4 sw architectures and sparql
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphs
 
SPIN in Five Slides
SPIN in Five SlidesSPIN in Five Slides
SPIN in Five Slides
 
RDF Tutorial - SPARQL 20091031
RDF Tutorial - SPARQL 20091031RDF Tutorial - SPARQL 20091031
RDF Tutorial - SPARQL 20091031
 
The Semantics of SPARQL
The Semantics of SPARQLThe Semantics of SPARQL
The Semantics of SPARQL
 
Federation and Navigation in SPARQL 1.1
Federation and Navigation in SPARQL 1.1Federation and Navigation in SPARQL 1.1
Federation and Navigation in SPARQL 1.1
 
Jena Programming
Jena ProgrammingJena Programming
Jena Programming
 
Sparql
SparqlSparql
Sparql
 
NoSQL and Triple Stores
NoSQL and Triple StoresNoSQL and Triple Stores
NoSQL and Triple Stores
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
SWT Lecture Session 11 - R2RML part 2
SWT Lecture Session 11 - R2RML part 2SWT Lecture Session 11 - R2RML part 2
SWT Lecture Session 11 - R2RML part 2
 
Advance Scala - Oleg Mürk
Advance Scala - Oleg MürkAdvance Scala - Oleg Mürk
Advance Scala - Oleg Mürk
 
SWT Lecture Session 10 R2RML Part 1
SWT Lecture Session 10 R2RML Part 1SWT Lecture Session 10 R2RML Part 1
SWT Lecture Session 10 R2RML Part 1
 

Semelhante a Data translation with SPARQL 1.1

Triplestore and SPARQL
Triplestore and SPARQLTriplestore and SPARQL
Triplestore and SPARQLLino Valdivia
 
Rdf data-model-and-storage
Rdf data-model-and-storageRdf data-model-and-storage
Rdf data-model-and-storage灿辉 葛
 
A Little SPARQL in your Analytics
A Little SPARQL in your AnalyticsA Little SPARQL in your Analytics
A Little SPARQL in your AnalyticsDr. Neil Brittliff
 
A hands on overview of the semantic web
A hands on overview of the semantic webA hands on overview of the semantic web
A hands on overview of the semantic webMarakana Inc.
 
Intro to Spark and Spark SQL
Intro to Spark and Spark SQLIntro to Spark and Spark SQL
Intro to Spark and Spark SQLjeykottalam
 
Validating and Describing Linked Data Portals using RDF Shape Expressions
Validating and Describing Linked Data Portals using RDF Shape ExpressionsValidating and Describing Linked Data Portals using RDF Shape Expressions
Validating and Describing Linked Data Portals using RDF Shape ExpressionsJose Emilio Labra Gayo
 
LarKC Tutorial at ISWC 2009 - Data Model
LarKC Tutorial at ISWC 2009 - Data ModelLarKC Tutorial at ISWC 2009 - Data Model
LarKC Tutorial at ISWC 2009 - Data ModelLarKC
 
RSP-QL*: Querying Data-Level Annotations in RDF Streams
RSP-QL*: Querying Data-Level Annotations in RDF StreamsRSP-QL*: Querying Data-Level Annotations in RDF Streams
RSP-QL*: Querying Data-Level Annotations in RDF Streamskeski
 
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4j
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4jExplicit Semantics in Graph DBs Driving Digital Transformation With Neo4j
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4jConnected Data World
 
Towards Virtual Knowledge Graphs over Web APIs
Towards Virtual Knowledge Graphs over Web APIsTowards Virtual Knowledge Graphs over Web APIs
Towards Virtual Knowledge Graphs over Web APIsSpeck&Tech
 
Sparql service-description
Sparql service-descriptionSparql service-description
Sparql service-descriptionSTIinnsbruck
 
A Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebA Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebShamod Lacoul
 
Connecting Stream Reasoners on the Web
Connecting Stream Reasoners on the WebConnecting Stream Reasoners on the Web
Connecting Stream Reasoners on the WebJean-Paul Calbimonte
 
Data Integration And Visualization
Data Integration And VisualizationData Integration And Visualization
Data Integration And VisualizationIvan Ermilov
 
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)Olaf Hartig
 

Semelhante a Data translation with SPARQL 1.1 (20)

Triplestore and SPARQL
Triplestore and SPARQLTriplestore and SPARQL
Triplestore and SPARQL
 
Rdf data-model-and-storage
Rdf data-model-and-storageRdf data-model-and-storage
Rdf data-model-and-storage
 
A Little SPARQL in your Analytics
A Little SPARQL in your AnalyticsA Little SPARQL in your Analytics
A Little SPARQL in your Analytics
 
A hands on overview of the semantic web
A hands on overview of the semantic webA hands on overview of the semantic web
A hands on overview of the semantic web
 
SWT Lecture Session 3 - SPARQL
SWT Lecture Session 3 - SPARQLSWT Lecture Session 3 - SPARQL
SWT Lecture Session 3 - SPARQL
 
Intro to Spark and Spark SQL
Intro to Spark and Spark SQLIntro to Spark and Spark SQL
Intro to Spark and Spark SQL
 
Validating and Describing Linked Data Portals using RDF Shape Expressions
Validating and Describing Linked Data Portals using RDF Shape ExpressionsValidating and Describing Linked Data Portals using RDF Shape Expressions
Validating and Describing Linked Data Portals using RDF Shape Expressions
 
LarKC Tutorial at ISWC 2009 - Data Model
LarKC Tutorial at ISWC 2009 - Data ModelLarKC Tutorial at ISWC 2009 - Data Model
LarKC Tutorial at ISWC 2009 - Data Model
 
RSP-QL*: Querying Data-Level Annotations in RDF Streams
RSP-QL*: Querying Data-Level Annotations in RDF StreamsRSP-QL*: Querying Data-Level Annotations in RDF Streams
RSP-QL*: Querying Data-Level Annotations in RDF Streams
 
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4j
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4jExplicit Semantics in Graph DBs Driving Digital Transformation With Neo4j
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4j
 
Towards Virtual Knowledge Graphs over Web APIs
Towards Virtual Knowledge Graphs over Web APIsTowards Virtual Knowledge Graphs over Web APIs
Towards Virtual Knowledge Graphs over Web APIs
 
Meetup ml spark_ppt
Meetup ml spark_pptMeetup ml spark_ppt
Meetup ml spark_ppt
 
Sparql service-description
Sparql service-descriptionSparql service-description
Sparql service-description
 
A Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebA Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic Web
 
KIT Graduiertenkolloquium 11.05.2016
KIT Graduiertenkolloquium 11.05.2016KIT Graduiertenkolloquium 11.05.2016
KIT Graduiertenkolloquium 11.05.2016
 
Optimizing SPARQL Queries with SHACL.pdf
Optimizing SPARQL Queries with SHACL.pdfOptimizing SPARQL Queries with SHACL.pdf
Optimizing SPARQL Queries with SHACL.pdf
 
HyperGraphQL
HyperGraphQLHyperGraphQL
HyperGraphQL
 
Connecting Stream Reasoners on the Web
Connecting Stream Reasoners on the WebConnecting Stream Reasoners on the Web
Connecting Stream Reasoners on the Web
 
Data Integration And Visualization
Data Integration And VisualizationData Integration And Visualization
Data Integration And Visualization
 
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
 

Último

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Último (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Data translation with SPARQL 1.1

  • 1. WWW 2012 Tutorial Schema Mapping with SPARQL 1.1 Andreas Schultz (Freie Universität Berlin)
  • 2. Outline  Why Do We Want to Integrate Data?  Schema Mapping  Translating RDF Data with SPARQL 1.1  Mapping Patterns
  • 3. Motivation  Web of Data is heterogeneous  Many different and overlapping ways to represent information Distribution of the most widely used vocabularies
  • 4. Data is represented...  Using terms from a wide range of vocabularies  Using diverging structures  With values of different (data type) formats  Fine grained vs. coarse grained  Using different measuring units
  • 5. Naming Differences SELECT ?longTrack ?runtime { { ?longTrack mo:duration ?time } UNION { ?longTrack dbpedia-owl:runtime ?time } FILTER (?track > 300) }
  • 6. Structural Differences dbpedia:Three_Little_Birds dbpedia-owl:musicalArtist dbpedia:Bob_Marley_&_The_Wailers . dbpedia:Bob_Marley_&_The_Wailers foaf:made dbpedia:Three_Little_Birds .
  • 7. Value Level Differences  “2012-04-15” vs. “2012-04-15”^^xsd:date  “John Doe” vs. “John Doe”@en  20 in Celcius vs. 68 in Fahrenheit  “Doe, John” vs. “John Doe”
  • 8. Outline  Motivation  Schema Mapping  Translating RDF Data with SPARQL 1.1  Mapping Patterns
  • 9. Schema Mapping For data translation: A mapping specifies how data under a source representation is translated to a target representation, that is, the representation that you or your application expects.
  • 10. Ways to Express Executable Mappings for RDF Data  Ontology constructs  OWL, RDFS (rdfs:subClassOf, rdfs:subPropertyOf)  Rules  SWRL  RIF  Query Languages  SPARQL 1.1
  • 11. Outline  Motivation  Schema Mapping  Translating RDF Data with SPARQL 1.1  Mapping Patterns
  • 12. Data Translation with SPARQL 1.1  Nearly W3C Recommendation status  Many scalable SPARQL engine implementations out there  Data translation with SPARQL CONSTRUCT  Huge improvements to version 1.0 regarding data translation
  • 13. How to Use SPARQL Construct Mappings Ideally SELECT ?longTrack ?runtime FROM { Construct { ?subj target:relevantProperty ?obj } WHERE { ?subj sour:relProperty ?obj } } WHERE { ?subj target:relevantProperty ?obj . … }
  • 14. How to Use SPARQL Construct Mappings in Practice SELECT ?longTrack ?runtime FROM { Construct { ?subj target:relevantProperty ?obj } WHERE { ?subj sour:relProperty ?obj } } WHERE { ?subj target:relevantProperty ?obj . … }
  • 15. Possibilities  Execute all SPARQL Construct queries on the source data set(s) to generate local versions of the target data set(s)  Optionally merge multiple target data sets into one  Reference these files in FROM clause  Possibility we won't cover: Write the results directly into a RDF store and query the store.
  • 16. 1. Transform Data Sets with ARQ query –query=constructQuery.qry –data=sourceDataset.nt > targetDataset.ttl # Execute more queries …
  • 17. 2. Use Target Data Set Files in Query SELECT ?longTrack ?runtime FROM <targetDataset.ttl> FROM … WHERE { ?subj target:relevantProperty ?obj . … }
  • 18. Outline  Motivation  Schema Mapping  Translating RDF Data with SPARQL 1.1  Mapping Patterns
  • 19. Pattern based approach  Presentation of common mapping patterns  Ordered from common to not so common  Learn how to tackle these mapping patterns with SPARQL 1.1
  • 21. Rename Class / Property Substitute the class or property URI src:inst a dbpedia-owl:MusicalArtist src:inst a mo:MusicArtist
  • 22. Rename Class SPARQL Mapping: CONSTRUCT { ?s a mo:MusicArtist } WHERE { ?s a dbpedia-owl:MusicalArtist }
  • 23. Rename Property SPARQL Mapping: CONSTRUCT { ?s rdfs:label ?o } WHERE { ?s freebase:type.object.name ?o }
  • 25. Rename Class based on Property Existence Rename class based on the existence of a property relation. dbpedia:William_Shakespeare a dbpedia-owl:Person ; dbpedia-owl:deathDate "1616-04-23"^^xsd:date . dbpedia:William_Shakespeare a fb:people.deceased_person .
  • 26. Rename Class based on Property SPARQL Mapping: CONSTRUCT { ?s a freebase:people.deceased_person } WHERE { ?s a dbpedia-owl:Person ; dbpedia-owl:deathDate ?dd . }
  • 27. Rename Class based on Value Instances of the source class become instances of the target class if they have a specific property value. gw-p:Kurt_Joachim_Lauk_euParliament_1840_P a gw:Person ; gw:profession "politician"^^xsd:string . gw-p:Kurt_Joachim_Lauk_euParliament_1840_P ; a fb:government.politician .
  • 28. Rename Class based on Value SPARQL Mapping: CONSTRUCT { ?s a fb:government.politician } WHERE { ?s a gw:Person ; gw:profession "politician"^^xsd:string . }
  • 29. Reverse Property The target property represents the reverse relationship regarding the source property. dbpedia:Queens_of_the_Stone_Age dbpedia-owl:currentMember dbpedia:Joey_Castillo . dbpedia:Joey_Castillo mo:member_of dbpedia:Queens_of_the_Stone_Age .
  • 30. Reverse Property SPARQL Mapping: CONSTRUCT { ?s mo:member_of ?o } WHERE { ?o dbpedia-owl:currentMember ?s }
  • 31. Resourcesify Represent an attribute by a newly created resource that then carries the attribute value. dbpedia:The_Usual_Suspects dbpedia-owl:runtime 6360.0 . dbpedia:The_Usual_Suspects po:version _:new . _:new po:duration 6360.0 .
  • 32. Resourcesify SPARQL Mapping: CONSTRUCT { ?s po:version _:newversion . _:newversion po:runtime ?runtime . } WHERE { ?s dbpedia-owl:runtime ?runtime . }
  • 33. Deresourcesify Inverse pattern to the Resourcesify pattern. dbpedia:John_F._Kennedy_International_Airport dbpedia-owl:city dbpedia:New_York_City . dbpedia:New_York_City rdfs:label "New York City" . dbpedia:John_F._Kennedy_International_Airport lgdp:owner "New York City" .
  • 34. Deresourcesify SPARQL Mapping: CONSTRUCT { ?s lgdp:owner ?cityLabel . } WHERE { ?s dbpedia-owl:city ?city . ?city rdfs:label ?cityLabel . }
  • 35. Value Transformation based Mapping Patterns
  • 36. SPARQL 1.1 functions SPARQL 1.1 offers functions covering:  RDF terms (str, lang, IRI, STRDT etc.)  Strings (SUBSTR, UCASE etc.)  Numerics (abs, round etc.)  Dates and Times (now, year, month etc.)  Hash Functions (SHA1, MD5 etc.)  XPath Constructor Functions (xsd:float etc.)
  • 37. Transform Value 1:1 Transform the (lexical) value of a property. dbpedia:The_Shining_(film) dbpedia-owl:runtime 8520 . dbpedia:The_Shining_(film) movie:runtime 142 .
  • 38. Transform Value 1:1 SPARQL Mapping: CONSTRUCT { ?s movie:runtime ?runtimeInMinutes . } WHERE { ?s dbpedia-owl:runtime ?runtime . BIND(?runtime / 60 As ?runtimeInMinutes) } BIND( Expression As ?newVariable )
  • 39. Transform Literal to URI Transform a literal value into a URI. dbpedia:Von_Willebrand_disease dbpedia-owl:omim 193400 . Also 1:1 transformation pattern! dbpedia:Von_Willebrand_disease diseasome:omim <http://bio2rdf.org/omim:193400> .
  • 40. Transform Literal to URI SPARQL Mapping: CONSTRUCT { ?s diseasome:omim ?omimuri . } WHERE { ?s dbpedia-owl:omim ?omim . BIND(IRI(concat(“http://bio2rdf.org/omim:”, str(?omim))) As ?omimuri) }
  • 41. Construct Literals SPARQL 1.1 offers several functions to construct literals:  STR – returns the lexical form → plain literal  STRDT – construct data type literal  STRLANG – construct literal with language tag
  • 42. Cast to another Datatype fb:en.clint_eastwood fb:people.person.date_of_birth “1930-05-31T00:00:00”^^xsd:dateTime . fb:en.clint_eastwood dbpedia-owl:birthDate “1930-05-31”^^xsd:date .
  • 43. Cast to another Datatype SPARQL Mapping: CONSTRUCT { ?s dbpedia-owl:birthDate ?date } WHERE { ?s fb:people.person.date_of_birth ?dateTime . BIND(xsd:date(?dateTime) As ?date) }
  • 44. Transform Value N:1 Transform multiple values from different properties to a single value. dbpedia:William_Shakespeare foaf:givenName "William" ; foaf:surname "Shakespeare" . dbpedia:William_Shakespeare foaf:name "Shakespeare, William" .
  • 45. Transform Value N:1 SPARQL Mapping: CONSTRUCT { ?s foaf:name ?name } WHERE { ?s foaf:givenName ?givenName ; foaf:surname ?surname . BIND(CONCAT(?surname, “, ”, ?givenName) As ?name) }
  • 47. Aggregation Aggregate multiple values / occurrences into one value. fb:en.berlin_u-bahn fb:metropolitan_transit.transit_system.transit_lines fb:en.u1 ; fb:metropolitan_transit.transit_system.transit_lines fb:en.u3 . fb:en.berlin_u-bahn dbpedia-owl:numberOfLines 2 .
  • 48. Aggregation SPARQL Mapping: CONSTRUCT { ?s dbpedia-owl:numberOfLines ?nrOfLines } WHERE { { SELECT ?s (COUNT(?l) AS ?nrOfLines) { ?s fb:metropolitan_transit.transit_system.transit_lines ?l . } GROUP BY ?s } }
  • 50. Data Cleaning Integrating data cleaning into a mapping. fb:en.jimi_hendrix fb:people.person.date_of_birth "1942-11-27" . fb:en.josh_wink fb:people.person.date_of_birth "1970" . fb:en.jimi_hendrix dbpedia-owl:birthDate "1942-11-27"^^xsd:date
  • 51. Data Cleaning SPARQL Mapping: Construct { ?s dbpedia-owl:birthDate ?birthDate } Where { ?s fb:people.person.date_of_birth ?bd . FILTER regex(?bd, “[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]”) BIND ((xsd:date(?bd)) As ?birthDate) }