-
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 #85 from oeg-upm/dev
adding translation for in-memory RML
- Loading branch information
Showing
30 changed files
with
538 additions
and
119 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.5 | ||
1.2 |
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,46 @@ | ||
@prefix insta: <http://instagram.com/data/>. | ||
@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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>. | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>. | ||
@prefix sd: <https://w3id.org/okn/o/sd/>. | ||
@prefix kg4di: <https://w3id.org/kg4di/>. | ||
@prefix ql: <http://semweb.mmlab.be/ns/ql#>. | ||
@base <http://example.com/ns#>. | ||
|
||
|
||
<df_map_0> a rr:TriplesMap; | ||
|
||
rml:logicalSource [ | ||
a rml:LogicalSource; | ||
rml:source [ | ||
a sd:DatasetSpecification; | ||
sd:name "output_dataframe"; | ||
sd:hasDataTransformation[ | ||
sd:hasSoftwareRequirements "pandas>=1.1.0"; | ||
sd:hasSourceCode[ | ||
sd:programmingLanguage "Python3.9"; | ||
]; | ||
]; | ||
]; | ||
rml:referenceFormulation ql:DataFrame; | ||
]; | ||
rr:subjectMap [ | ||
a rr:SubjectMap; | ||
rr:template "http://instagram.com/data/user{Id}"; | ||
]; | ||
rr:predicateObjectMap [ | ||
rr:predicateMap [ | ||
a rr:PredicateMap; | ||
rr:constant rdf:type; | ||
]; | ||
rr:objectMap [ | ||
a rr:ObjectMap; | ||
rr:constant insta:User; | ||
]; | ||
]. | ||
|
||
|
||
ql:DataFrame a rml:ReferenceFormulation; | ||
kg4di:definedBy "Pandas". |
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 was deleted.
Oops, something went wrong.
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,26 @@ | ||
__author__ = "Ioannis Dasoulas" | ||
__credits__ = ["Ioannis Dasoulas"] | ||
|
||
__license__ = "Apache-2.0" | ||
__maintainer__ = "David Chaves-Fraga" | ||
__email__ = "[email protected]" | ||
|
||
|
||
import os | ||
from ruamel.yaml import YAML | ||
import yatter | ||
from rdflib.graph import Graph | ||
from rdflib import compare | ||
RML_URI = 'http://semweb.mmlab.be/ns/rml#' | ||
|
||
|
||
def test_imtc001(): | ||
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=RML_URI), format="ttl") | ||
|
||
assert compare.isomorphic(expected_mapping, translated_mapping) |
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,26 @@ | ||
__author__ = "Ioannis Dasoulas" | ||
__credits__ = ["Ioannis Dasoulas"] | ||
|
||
__license__ = "Apache-2.0" | ||
__maintainer__ = "David Chaves-Fraga" | ||
__email__ = "[email protected]" | ||
|
||
|
||
import os | ||
from ruamel.yaml import YAML | ||
import yatter | ||
from rdflib.graph import Graph | ||
from rdflib import compare | ||
RML_URI = 'http://semweb.mmlab.be/ns/rml#' | ||
|
||
|
||
def test_imtc002(): | ||
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=RML_URI), format="ttl") | ||
|
||
assert compare.isomorphic(expected_mapping, translated_mapping) |
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
Oops, something went wrong.