Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
.idea/
venv
*__pycache__
test-cases/burp.jar
test-cases/burp.jar
30 changes: 30 additions & 0 deletions shapes/lv.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,33 @@ rmlsh:InclusionAnnotationShape a sh:NodeShape;
sh:maxCount 1 ;
sh:nodeKind sh:BlankNodeOrIRI ;
] .

rmlsh:parentCyclesShape a sh:NodeShape ;
sh:targetSubjectsOf rml:viewOn ;
sh:targetSubjectsOf rml:field ;
sh:sparql [
a sh:SPARQLConstraint ;
sh:message "There must be no cycles via rml:viewOn or rml:Field." ;
sh:select """
PREFIX rml: <http://w3id.org/rml/>
SELECT ?this
WHERE {
?this (rml:viewOn|rml:field)+ ?this .
}
""" ;
] .

rmlsh:joinCyclesShape a sh:NodeShape ;
sh:targetSubjectsOf rml:viewOn ;
sh:sparql [
a sh:SPARQLConstraint ;
sh:message "There must be no cycles via rml:viewOn and rml:leftJoin or rml:innerJoin." ;
sh:select """
PREFIX rml: <http://w3id.org/rml/>
SELECT ?this
WHERE {
?this a rml:LogicalView .
?this ((rml:leftJoin|rml:innerJoin)/rml:parentLogicalView)+ ?this .
}
""" ;
] .
2 changes: 1 addition & 1 deletion spec/section/joins.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using a <a data-cite="RML-Core#dfn-join-condition">join condition</a>.
A [=logical view join=] MUST contain:
- exactly one parent logical view property (`rml:parentLogicalView`), whose value is a [=logical view=] (`rml:LogicalView`) that supplies the additional fields. This is referred to as the <dfn>parent logical view</dfn>.
- at least one join condition property (`rml:joinCondition`), whose value is a <a data-cite="RML-Core#dfn-join-condition">join condition</a>.
- at least one field property (`rml:field`), whose value is an [=expression field=] (`rml:ExpressionField`). This field SHOULD only contain [=logical view references=] that can be evaluated on the parent logical view.
- at least one field property (`rml:field`), whose value is an [=expression field=] (`rml:ExpressionField`). This field MUST only contain [=logical view references=] that can be evaluated on the parent logical view. The [=absolute name=] of this field, which equals its [=declared name=], MUST be unique within the [=child logical view=].

Similar to how <a data-cite="RML-Core#joins">joins are defined in RML-Core</a>,
the [=logical view=] in the subject position of the [=join property=] fulfills the role of <!-- TODO reference to core child logical source when available-->[child logical source]() in the <a data-cite="RML-Core#dfn-join-condition">join condition(s)</a>, but of the [=logical view join=], and is referred to as <dfn>child logical view</dfn>.
Expand Down
2 changes: 1 addition & 1 deletion spec/section/views.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ When a non-existing or a non-referenceable key is referenced, RML processors sho
rml:field [
a rml:IterableField ;
rml:fieldName "item" ;
rml:reference "$.items[*]" ;
rml:iterator "$.items[*]" ;
rml:field [
a rml:ExpressionField ;
rml:fieldName "type" ;
Expand Down
2 changes: 1 addition & 1 deletion test-cases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ The test cases publication (html pages) can be generated as followed:
4. Download burp: `curl -LO https://github.com/kg-construct/BURP/releases/download/v0.1.1/burp.jar`
5. Generate the manifest with [Burp](https://github.com/kg-construct/BURP): `java -jar burp.jar -m manifest.rml.ttl -o manifest.ttl -b http://w3id.org/rml/lv/test/`
6. Run list.sh and insert output in dev.html
7. To publish the new HTML verson of the test cases, export `dev.html` as `index.html` in ./docs and in a subfolder with the date of the publication (maybe adapt the publication date)
7. To publish the new HTML verson of the test cases, run with `python3 -m http.server`, export `dev.html` as `index.html` in ./docs and in a subfolder with the date of the publication (maybe adapt the publication date)
70 changes: 70 additions & 0 deletions test-cases/RMLLVTC0008d/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
## RMLLVTC0008d

**Title**: Cycle: Fields

**Description**: Test a cycle in nested fields

**Error expected?** Yes

**Input**
```
{
"people": [
{
"name": "alice",
"items": [
{
"type": "sword",
"weight": 1500
},
{
"type": "shield",
"weight": 2500
}
]
},
{
"name": "bob",
"items": [
{
"type": "flower",
"weight": 15
}
]
}
]
}

```

**Mapping**
```
@prefix rml: <http://w3id.org/rml/> .
@prefix : <http://example.org/> .

:jsonSource a rml:LogicalSource ;
rml:source [
a rml:RelativePathSource , rml:Source ;
rml:root rml:MappingDirectory ;
rml:path "people.json" ;
] ;
rml:referenceFormulation rml:JSONPath ;
rml:iterator "$.people[*]" .

:jsonView a rml:LogicalView ;
rml:viewOn :jsonSource ;
rml:field :field1 .

:field1 a rml:IterableField ;
rml:fieldName "item" ;
rml:referenceFormulation rml:JSONPath ;
rml:iterator "$.items[*]" ;
rml:field :field2.

:field2 a rml:ExpressionField ;
rml:fieldName "type" ;
rml:reference "$.type" ;
rml:field :field1.

```

26 changes: 26 additions & 0 deletions test-cases/RMLLVTC0008d/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@prefix rml: <http://w3id.org/rml/> .
@prefix : <http://example.org/> .

:jsonSource a rml:LogicalSource ;
rml:source [
a rml:RelativePathSource , rml:Source ;
rml:root rml:MappingDirectory ;
rml:path "people.json" ;
] ;
rml:referenceFormulation rml:JSONPath ;
rml:iterator "$.people[*]" .

:jsonView a rml:LogicalView ;
rml:viewOn :jsonSource ;
rml:field :field1 .

:field1 a rml:IterableField ;
rml:fieldName "item" ;
rml:referenceFormulation rml:JSONPath ;
rml:iterator "$.items[*]" ;
rml:field :field2.

:field2 a rml:ExpressionField ;
rml:fieldName "type" ;
rml:reference "$.type" ;
rml:field :field1.
26 changes: 26 additions & 0 deletions test-cases/RMLLVTC0008d/people.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"people": [
{
"name": "alice",
"items": [
{
"type": "sword",
"weight": 1500
},
{
"type": "shield",
"weight": 2500
}
]
},
{
"name": "bob",
"items": [
{
"type": "flower",
"weight": 15
}
]
}
]
}
65 changes: 65 additions & 0 deletions test-cases/RMLLVTC0009a/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
## RMLLVTC0009a

**Title**: Name collision: between Fields with the same Parent

**Description**: Test a name collision between fields with the same parent

**Error expected?** Yes

**Input**
```
{
"people": [
{
"givenName": "Alice",
"familyName": "Smith"
},
{
"givenName": "Bob",
"familyName": "Johnson"
}
]
}

```

**Mapping**
```
@prefix rml: <http://w3id.org/rml/> .
@prefix : <http://example.org/> .

:jsonSource a rml:LogicalSource ;
rml:source [
a rml:RelativePathSource , rml:Source ;
rml:root rml:MappingDirectory ;
rml:path "people.json" ;
] ;
rml:referenceFormulation rml:JSONPath ;
rml:iterator "$.people[*]" .

:jsonView a rml:LogicalView ;
rml:viewOn :jsonSource ;
rml:field [
a rml:ExpressionField ;
rml:fieldName "name" ;
rml:reference "$.givenName" ;
], [
a rml:ExpressionField ;
rml:fieldName "name" ;
rml:reference "$.familyName" ;
] .

:triplesMapPerson a rml:TriplesMap ;
rml:logicalSource :jsonView ;
rml:subjectMap [
rml:template "http://example.org/person/{name}" ;
] ;
rml:predicateObjectMap [
rml:predicate :hasName ;
rml:objectMap [
rml:reference "name" ;
] ;
] .

```

35 changes: 35 additions & 0 deletions test-cases/RMLLVTC0009a/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@prefix rml: <http://w3id.org/rml/> .
@prefix : <http://example.org/> .

:jsonSource a rml:LogicalSource ;
rml:source [
a rml:RelativePathSource , rml:Source ;
rml:root rml:MappingDirectory ;
rml:path "people.json" ;
] ;
rml:referenceFormulation rml:JSONPath ;
rml:iterator "$.people[*]" .

:jsonView a rml:LogicalView ;
rml:viewOn :jsonSource ;
rml:field [
a rml:ExpressionField ;
rml:fieldName "name" ;
rml:reference "$.givenName" ;
], [
a rml:ExpressionField ;
rml:fieldName "name" ;
rml:reference "$.familyName" ;
] .

:triplesMapPerson a rml:TriplesMap ;
rml:logicalSource :jsonView ;
rml:subjectMap [
rml:template "http://example.org/person/{name}" ;
] ;
rml:predicateObjectMap [
rml:predicate :hasName ;
rml:objectMap [
rml:reference "name" ;
] ;
] .
12 changes: 12 additions & 0 deletions test-cases/RMLLVTC0009a/people.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"people": [
{
"givenName": "Alice",
"familyName": "Smith"
},
{
"givenName": "Bob",
"familyName": "Johnson"
}
]
}
Loading
Loading