RMLio / rmlmapper-java

The RMLMapper executes RML rules to generate high quality Linked Data from multiple originally (semi-)structured data sources
http://rml.io
MIT License
146 stars 61 forks source link

No triples with xmlns in XML source #154

Closed RichDijk closed 2 years ago

RichDijk commented 2 years ago

Using XML input for the RML mapper gives unexplained behaviour, at least to me.

No triples are created when in the xml input a namespace is defined like

xmlns="http://graphml.graphdrawing.org/xmlns"

rdfizer has the same behaviour, see issue

Can this be explained? yedmapping1.rml.zip

DylanVanAssche commented 2 years ago

XML namespaces are now well supported in RML, there's a proposal in the Knowledge Graph Construction Community Group to properly support it: https://github.com/kg-construct/rml-target-source-spec

However, there's some support for namespaces in the RMLMapper, I tried your mappings and could reproduce it.

julianrojas87 commented 2 years ago

I had a similar issue with some XML mappings. They were working well until the changes of #134 were introduced.

However, I found that since then, XPath expressions MUST include prefix declarations, if these are defined in the source XML. This means that expressions referring to nodes of the default namespace need to include : for them to work. @RichDijk I tested this mapping on your example and it worked:

@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix data: <http://data.zorgaanbiederX.nl/data/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix wlz: <http://purl.org/ozo/wlz#>.
@prefix skos: <http://www.w3.org/2004/02/skos/core#>.
@prefix yedd: <http://www.yed.com/yedd#>.
@base <http://data.zorgaanbiederX.nl/data/>.

<#IdNode>
    a rr:TriplesMap;
    rml:logicalSource [
        rml:source "skos1a.graphml";
        rml:referenceFormulation ql:XPath;
        rml:iterator "/:graphml/:graph"];
    rr:subjectMap [
        a rr:Subject;
        rr:termType rr:IRI;
        rr:template "http://www.yed.com/yedd#node_{@id}";
        rr:class yedd:Node;
    ];
.