Movatterモバイル変換


[0]ホーム

URL:


W3C

RML-star

Draft Community Group Report

Latest published version:
none
Latest editor's draft:
https://w3id.org/rml/star/spec
Editors:
Ana Iglesias-Molina (Universidad Politécnica de Madrid)
Julián Arenas-Guerrero (Universidad Politécnica de Madrid)
Thomas Delva (Ghent University – imec – IDLab)
Anastasia Dimou (KU Leuven)
David Chaves-Fraga (Universidad Politécnica de Madrid)
This Version:
https://kg-construct.github.io/rml-star/spec/docs/20230510/
Previous Version:
https://kg-construct.github.io/rml-star/spec/docs/20221126/
Website:
https://w3id.org/rml/portal/
Feedback:
GitHub kg-construct/rml-star (issues,pull requests)

Copyright © 2023 the Contributors to the RML-star Specification, published by theKnowledge Graph Construction Community Group under theW3C Community Contributor License Agreement (CLA). A human-readablesummary is available.


Abstract

This document describes the [RML] vocabulary and approach to generate RDF-star [RDF-star].

Status of This Document

This specification was published by theKnowledge Graph Construction Community Group. It is not a W3C Standard nor is it on the W3C Standards Track. Please note that under theW3C Community Contributor License Agreement (CLA) there is a limited opt-out and other conditions apply. Learn more aboutW3C Community and Business Groups.

1.Conformance

As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

2.Introduction

This section is non-normative.

2.1Overview

RDF-star [RDF-star] is an extension of the Resource Description Framework (RDF) [RDF11-Concepts] that introduces a new kind of term, thequoted triple, which can be referred from the subjects or objects of other triples. Triples that include a quoted triple are known asRDF-star triples.

# The triple ( :Alice a :Person ) is 80% likely to be true<< :Alice a :Person >> :confidence 0.8 .

In RDF 1.1, anasserted triple is an element of the set of triples that compose anRDF graph. In RDF-star, a quoted triple can be asserted, if it is also included in the RDF graph, or not, if it only occurs as a quoted triple.

# The triple ( :Alice a :Person ) is asserted and quoted< :Alice a :Person > .<< :Alice a :Person >> :confidence 0.8 .

The RDF Mapping Language (RML) [RML] is a language for expressing mappings between heterogeneous data and RDF. In RML, rules can be expressed to iterate over a data source and refer to specific data within an iteration. Using these iterators and references, RML rules define how to express data in the data source in RDF. RML is based on and extends R2RML [R2RML]. R2RML is defined to express customized mappings only from relational databases to RDF datasets.

This document describes RML-star: an extension of RML that enables the generation of RDF-star graphs with RML.

2.2Conventions

This document assumes that the reader is familiar with RDF, RML and RDF-star concepts.

In this document, examples assume that the following prefixes have been declared to represent the IRIs shown with them:

PrefixNamespace
rml:http://w3id.org/rml/
xsd:http://www.w3.org/2001/XMLSchema#
ex:http://example.org/
:http://example.org/

The examples are contained in color-coded boxes. We use the Turtle syntax [Turtle] to write RDF and the N-Triples-star syntax [RDF-star] to write RDF-star.

# This box contains an example input
# This box contains an example mapping
# This box contains the example output

3.The RML-star vocabulary

AnRML-star mapping defines a mapping from any data in a structured source format to RDF-star. It consists of one or moreTriples Maps that can in turn contain Triples Maps within the subject or object. A Triples Map can be Asserted or Non Asserted, depending on whether the triples that they generate should be included in the output graph.

The input to an RML-star mapping is called input data source. The output of an RML-star mapping is called output dataset.

The output dataset of an RML-star mapping is an RDF-star dataset that contains the generatedRDF-star triples for each of theTriples Maps in the RML-star mapping. AnRML-star processor may provide additional triples or graphs.

As in RML, conformingRML-star processors may rename blank nodes when providing access to the output dataset.

AnRML-star processor has access to one of the followings:

Abase IRI is used in resolving relativeIRIs produced by theRML-star mappings. According to the [R2RML] specification, the base IRI must be a valid [IRI]. It should not contain question mark (“?”) or hash (“#”) characters and should end in a slash (“/”) character.

The RML-star vocabulary consists of the RML-star specific defined classes but also includes some [RML] classes.

3.1Overview of RML-star terms

The RML-star terms are summarized in the following tables.This vocabulary involves three classes (rml:StarMap,rml:AssertedTriplesMap andrml:NonAssertedTriplesMap), and one object property (rml:quotedTriplesMap).

PropertyDomainRange
rml:quotedTriplesMaprml:StarMaprml:AssertedTriplesMap or rml:NonAssertedTriplesMap
ClassSuperclass
rml:StarMapowl:Thing
rml:AssertedTriplesMaprml:TriplesMap
rml:NonAssertedTriplesMaprml:TriplesMap

All RML-star additions and changes to RML are shown in Figure 1:

Target structure
Figure1To enable the generation of RDF-star graphs, RML-star adds three classes and one object property to the RML ontology.

4.Generating quoted triples with RML-star

AStar Map (rml:StarMap) is similar to aterm map that generatesquoted triples.It can be used within Subject or Object Maps.A Star Map is linked to aTriples Map by thequoted Triples Map property (rml:quotedTriplesMap).Thequoted triples generated by aStar Map are exactly those triples generated by itsquoted Triples Map.If a Star Map has the samelogical source as itsquoted Triples Map, then for eachlogical iteration, thequoted triples generated by a Star Map are those triples generated by itsquoted Triples Mapfor the same logical iteration.If a Star Map has a different logical source than its quoted Triples Map then a join is used, as described inthe next section.

In the following example, for each logical iteration (i.e., each CSV row) a "type" triple is generated by<#innerTriplesMap> that occursin the resulting graph both as an asserted and as a quoted triple:

# Contents of the ex:ConfidenceSource logical sourceentity , class  , confidenceAlice  , Person , 0.8Bobby  , Dog    , 0.6
# Triples Map that generates "type" triples that are asserted and quoted<#innerTriplesMap>    a rml:AssertedTriplesMap;    rml:logicalSource ex:ConfidenceSource;    rml:subjectMap [        rml:template "http://example.com/{entity}"    ];    rml:predicateObjectMap [        rml:predicate rdf:type;        rml:objectMap [ rml:template "http://example.com/{class}" ];    ].# Triples Map that generates "confidence" triples<#outerTriplesMap>    a rml:AssertedTriplesMap;    rml:logicalSource ex:ConfidenceSource;    rml:subjectMap [rml:quotedTriplesMap <#innerTriplesMap>;    ];    rml:predicateObjectMap [        rml:predicate ex:confidence;        rml:objectMap [ rml:reference "confidence" ];    ].
# Triples generated by <#innerTriplesMap>ex:Alice a ex:Person .ex:Bobby a ex:Dog .# Triples generated by <#outerTriplesMap><< ex:Alice a ex:Person >> ex:confidence 0.8 .<< ex:Bobby a ex:Dog >> ex:confidence 0.6 .

The previous example shows aquoted triple within a Subject Map.Sincequoted triples can be both subjects or objects,Star Maps can alsobe used in the position of Object Maps, as shown in the following example:

# Contents of the ex:ConfidenceSource logical sourceentity , pet     , classAlice  , Bobby   , DogSteve  , Pumpkin , Cat
# Triples Map that generates "type" triples that are asserted and quoted<#innerTriplesMap>    a rml:AssertedTriplesMap;    rml:logicalSource ex:ConfidenceSource;    rml:subjectMap [        rml:template "http://example.com/{pet}"    ];    rml:predicateObjectMap [        rml:predicate rdf:type;        rml:objectMap [ rml:template "http://example.com/{class}" ];    ].# Triples Map that generates "has pet" triples<#outerTriplesMap>    a rml:AssertedTriplesMap;    rml:logicalSource ex:ConfidenceSource;    rml:subjectMap [        rml:template "http://example.com/{entity}";    ];    rml:predicateObjectMap [        rml:predicate ex:has_pet;rml:objectMap [ rml:quotedTriplesMap <#innerTriplesMap> ];    ].
# Triples generated by <#innerTriplesMap>ex:Bobby a ex:Dog .ex:Pumpkin a ex:Cat .# Triples generated by <#outerTriplesMap>ex:Alice ex:has_pet << ex:Bobby a ex:Dog >> .ex:Steve ex:has_pet << ex:Pumpkin a ex:Cat >> .

Asserted Triples Map generateasserted triples.If an Asserted Triples Map is also used in aStar Map, the triples it generatesalso occur in the resulting graph asquoted triples, by the process explained above.To generatequoted triples without assering them, Non Asserted Triples Maps are used instead.A Triples Map of subclassnon-asserted Triples Map does not generateasserted triples,but might generatequoted triples if it is used in aStar Map.

The following example is different than the previous in that<#innerTriplesMap> is declared to be an instance ofrml:NonAssertedTriplesMap, with the effect that the generated "type" triples are only present in the resulting graph asquoted triples, not asasserted triples:

# Contents of the ex:ConfidenceSource logical sourceentity , class  , confidenceAlice  , Person , 0.8Bobby  , Dog    , 0.6
# Triples Map that generates "type" triples that are only quoted, not asserted<#innerTriplesMap>a rml:NonAssertedTriplesMap;    rml:logicalSource ex:ConfidenceSource;    rml:subjectMap [        rml:template "http://example.com/{entity}";    ];    rml:predicateObjectMap [        rml:predicate rdf:type;        rml:objectMap [ rml:template "http://example.com/{class}" ];    ].# Triples Map that generates "confidence" triples<#outerTriplesMap>    a rml:AssertedTriplesMap;    rml:logicalSource ex:ConfidenceSource;    rml:subjectMap [        rml:quotedTriplesMap <#innerTriplesMap>;    ];    rml:predicateObjectMap [        rml:predicate ex:confidence;        rml:objectMap [ rml:reference "confidence" ];    ].
<< ex:Alice a ex:Person >> ex:confidence 0.8 .<< ex:Bobby a ex:Dog >> ex:confidence 0.6 .

A summary of how to generate triples in any combination ofasserted and/orquoted triples is given in the following table:

QuotedNot quoted
Assertedrml:AssertedTriplesMapwithrml:StarMaprml:AssertedTriplesMapwithoutrml:StarMap
Not assertedrml:NonAssertedTriplesMapwithrml:StarMap-

It should be noted that Non Asserted Triples Maps that are not quoted do not generate any triple. For this reason, the use ofrml:NonAssertedTriplesMapwithoutrml:StarMapis not allowed.rml:NonAssertedTriplesMap must always be called withrml:quotedTriplesMap.

5.Generating quoted triples from multiple sources

RML-star can create RDF-star triples from multiplelogical sources.When creating RDF-star triples from multiplelogical sources,join conditions are used, just like when usingreferencing object maps in RML.

If astar map has ajoin condition, it generatesquoted triples as follows. Each combination of iterations, i.e., theCartesian product, from thechild source and theparent source is looked at. Here, we consider as child source thelogical source of theTriples Map in which the star map occurs, and as parent source the logical source of the star map'sQuoted Triples Map. A star map only generates quoted triples for combinations in which the join condition holds true. As is the case whenjoin conditions are used in in referencing object maps, a join condition checks for equality of thereference values of thechild/parent reference between iterations of the child/parent source.

If thelogical source of Triples Map in which astar map occurs and the logical source of star map'sQuoted Triples Map are not identical, then the star map must have at least onejoin condition.

# Contents of logical source ex:ClassesSourceentity , classAlice  , PersonBobby  , Dog
# Contents of logical source ex:ConfidencesSourceentity , confidenceAlice  , 0.8Bobby  , 0.6
# Triples Map that generates "type" triples<#innerTriplesMap>    a rml:NonAssertedTriplesMap ;    rml:logicalSource ex:ClassesSource ;    rml:subjectMap [        rml:template "http://example.com/{entity}"    ];    rml:predicateObjectMap [        rml:predicate rdf:type ;        rml:objectMap [ rml:template "http://example.com/{class}" ]    ].# Triples Map that generates "confidence" triples<#outerTriplesMap>    a rml:AssertedTriplesMap;    rml:logicalSource ex:ConfidencesSource;    rml:subjectMap [        rml:quotedTriplesMap <#innerTriplesMap>rml:joinCondition [            rml:parent "entity";            rml:child "entity";        ];    ];    rml:predicateObjectMap [        rml:predicate ex:confidence;        rml:objectMap [ rml:reference "confidence" ];    ].
<< ex:Alice a ex:Person >> ex:confidence 0.8 .<< ex:Bobby a ex:Dog >> ex:confidence 0.6 .

5.1Using star map together with referencing object maps

It is also possible to generatequoted triples which themselves are built from multiple sources.This is done by using aQuoted Triples Map which contains areferencing object map.

Note: this process for generatingquoted triples with areferencing object map is not different from the general process to create quoted triplesdescribed earlier, but we include this section for clarity.

# Contents of logical source ex:ClassesSourceentity , classAlice  , PersonBobby  , Dog
# Contents of logical source ex:ConfidencesSourceentity , confidenceAlice  , 0.8Bobby  , 0.6
# Triples Map that generates objects of "type" triples<#classTriplesMap>    a rml:AssertedTriplesMap;    rml:logicalSource ex:ClassesSource;    rml:subjectMap [        rml:template "http://example.com/{class}";    ].# Triples Map that generates "type" triples using a join<#innerTriplesMap>    a rml:NonAssertedTriplesMap;    rml:logicalSource ex:ConfidencesSource;    rml:subjectMap [        rml:template "http://example.com/{entity}";    ];    rml:predicateObjectMap [        rml:predicate rdf:type ;        rml:objectMap [rml:parentTriplesMap <#classTriplesMap> ;            rml:joinCondition [                rml:parent "entity" ;                rml:child "entity" ;            ];        ];    ].# Triples Map that generates "confidence" triples<#outerTriplesMap>    a rml:AssertedTriplesMap;    rml:logicalSource ex:ConfidencesSource;    rml:subjectMap [        rml:quotedTriplesMap <#innerTriplesMap>;    ];    rml:predicateObjectMap [        rml:predicate ex:confidence;        rml:objectMap [ rml:reference "confidence" ];    ].
<< ex:Alice a ex:Person >> ex:confidence 0.8 .<< ex:Bobby a ex:Dog >> ex:confidence 0.6 .

6.Generating deeply nested quoted triples

It is possible to create more deeply nested RDF-star by using aQuoted Triples Map that on its own turn also uses a Quoted Triples Map.

Note: this process for generating deeply nestedquoted triples is not different from the general process to create quoted triplesdescribed earlier, but we include this section for clarity.

# Contents of Logical Source ex:PredictionsSourceentity , class   , confidence , predictorAlice  , Person  , 0.8        , alphaAlice  , Giraffe , 1.0        , alphaBobby  , Dog     , 0.6        , alphaBobby  , Giraffe , 1.0        , beta
# Triples Map that generates "type" triples<#innerTriplesMap>    a rml:NonAssertedTriplesMap;    rml:logicalSource ex:PredictionsSource;    rml:subjectMap [        rml:template "http://example.com/{entity}";    ];    rml:predicateObjectMap [        rml:predicate rdf:type;        rml:objectMap [ rml:template "http://example.com/{class}" ];    ].# Triples Map that generates "confidence" triples<#middleTriplesMap>    a rml:NonAssertedTriplesMap;    rml:logicalSource ex:PredictionsSource;    rml:subjectMap [rml:quotedTriplesMap <#innerTriplesMap>;    ];    rml:predicateObjectMap [        rml:predicate ex:confidence;        rml:objectMap [ rml:reference "confidence" ];    ].# Triples Map that generates "predicted by" triples<#outerTriplesMap>    a rml:AssertedTriplesMap;    rml:logicalSource ex:PredictionsSource;    rml:subjectMap [rml:quotedTriplesMap <#middleTriplesMap>;    ];    rml:predicateObjectMap [        rml:predicate ex:predictedBy;        rml:objectMap [ rml:template "http://example.com/{predictor}" ];    ].
<< << ex:Alice a ex:Person >> ex:confidence 0.8 >> ex:predictedBy ex:alpha .<< << ex:Alice a ex:Giraffe >> ex:confidence 1.0 >> ex:predictedBy ex:beta .<< << ex:Bobby a ex:Dog >> ex:confidence 0.6 >> ex:predictedBy ex:alpha .<< << ex:Bobby a ex:Giraffe >> ex:confidence 1.0 >> ex:predictedBy ex:beta .

A.References

A.1Normative references

[IRI]
Internationalized Resource Identifiers (IRIs). M. Duerst; M. Suignard. IETF. January 2005. Proposed Standard. URL:https://www.rfc-editor.org/rfc/rfc3987
[R2RML]
R2RML: RDB to RDF Mapping Language. W3C. 27 September 2012. W3C Recommendation. URL:https://www.w3.org/TR/r2rml/
[RDF-star]
RDF-star and SPARQL-star. W3C. 17 December 2021. Final Community Group Report. URL:https://www.w3.org/2021/12/rdf-star.html
[RDF11-Concepts]
RDF 1.1 Concepts and Abstract Syntax. W3C. 25 February 2014. W3C Recommendation. URL:https://www.w3.org/TR/rdf11-concepts/
[RML]
RDF Mapping Language - Core. https://www.w3.org/community/kg-construct/. 30 June 2023. Draft Community Group Report. URL:https://w3id.org/core/spec/
[Turtle]
RDF 1.1 Turtle. W3C. 25 February 2014. W3C Recommendation. URL:https://www.w3.org/TR/turtle/


[8]ページ先頭

©2009-2025 Movatter.jp