-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from oeg-upm/blank-node-implementation
supporting blank nodes with data reference
- Loading branch information
Showing
8 changed files
with
129 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.1.0 | ||
1.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
@prefix foaf: <http://xmlns.com/foaf/0.1/>. | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. | ||
@prefix ex: <http://example.com/>. | ||
@prefix rr: <http://www.w3.org/ns/r2rml#>. | ||
@prefix rml: <http://semweb.mmlab.be/ns/rml#>. | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>. | ||
@prefix ql: <http://semweb.mmlab.be/ns/ql#>. | ||
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#>. | ||
@prefix schema: <http://schema.org/>. | ||
@prefix formats: <http://www.w3.org/ns/formats/>. | ||
@prefix comp: <http://semweb.mmlab.be/ns/rml-compression#>. | ||
@prefix void: <http://rdfs.org/ns/void#>. | ||
@prefix fnml: <http://semweb.mmlab.be/ns/fnml#>. | ||
@prefix grel: <http://users.ugent.be/~bjdmeest/function/grel.ttl#>. | ||
@base <http://example.com/ns#>. | ||
|
||
|
||
<TriplesMap1_0> a rr:TriplesMap; | ||
|
||
rr:logicalTable [ | ||
a rr:LogicalTable; | ||
rr:tableName "Student"; | ||
rr:sqlVersion rr:SQL2008 | ||
]; | ||
rr:subjectMap [ | ||
a rr:SubjectMap; | ||
rr:column "Name"; | ||
rr:termType rr:BlankNode | ||
]; | ||
rr:predicateObjectMap [ | ||
rr:predicateMap [ | ||
a rr:PredicateMap; | ||
rr:constant rdf:type; | ||
]; | ||
rr:objectMap [ | ||
a rr:ObjectMap; | ||
rr:constant foaf:Person; | ||
]; | ||
rr:objectMap [ | ||
a rr:ObjectMap; | ||
rr:constant ex:Student; | ||
]; | ||
]; | ||
rr:predicateObjectMap [ | ||
rr:predicateMap [ | ||
a rr:PredicateMap; | ||
rr:constant foaf:Name; | ||
]; | ||
rr:objectMap [ | ||
a rr:ObjectMap; | ||
rr:column "Name"; | ||
rr:termType rr:BlankNode | ||
]; | ||
]. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
prefixes: | ||
foaf: http://xmlns.com/foaf/0.1/ | ||
rdfs: http://www.w3.org/2000/01/rdf-schema# | ||
ex: http://example.com/ | ||
|
||
mappings: | ||
TriplesMap1: | ||
sources: | ||
- table: Student | ||
s: | ||
value: $(Name) | ||
type: blank | ||
po: | ||
- p: rdf:type | ||
o: [foaf:Person, ex:Student] | ||
- p: foaf:Name | ||
o: | ||
value: $(Name) | ||
type: blank |
27 changes: 27 additions & 0 deletions
27
test/r2rml/YARRRMLTC-r2rml-0016/test_yarrrmltc_r2rml_0016.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
__author__ = "Marino Gonzalez Garcia" | ||
__credits__ = ["Marino Gonzalez Garcia"] | ||
|
||
__license__ = "Apache-2.0" | ||
__maintainer__ = "David Chaves-Fraga" | ||
__email__ = "david.chaves@upm.es" | ||
|
||
|
||
import os | ||
from ruamel.yaml import YAML | ||
import yatter | ||
from rdflib.graph import Graph | ||
from rdflib import compare | ||
R2RML_URI = 'http://www.w3.org/ns/r2rml#' | ||
|
||
|
||
def test_r2rml_yarrrmltc0016(): | ||
expected_mapping = Graph() | ||
expected_mapping.parse(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mapping.ttl'), format="ttl") | ||
|
||
translated_mapping = Graph() | ||
yaml = YAML(typ='safe', pure=True) | ||
mapping_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'mapping.yml') | ||
translated_mapping.parse(data=yatter.translate(yaml.load(open(mapping_path)), mapping_format=R2RML_URI), format="ttl") | ||
translated_mapping.serialize(destination="mapping.rml.ttl",format="ttl") | ||
|
||
assert compare.isomorphic(expected_mapping, translated_mapping) |