I am using RML-Mapper library in order to convert xml file into rdf file. For the following xml file, catalogs.xml, I am having troubles to write the best mapping.ttl. My question is, what is the best mapping.ttl file for that specific xml? I provide catalogs.xml and catalog_mapping.ttl files below...
Catalogs.xml file
<catalog>
<product description="Cardigan Sweater" product_image="cardigan.jpg">
<catalog_item gender="Men's">
<item_number>QWZ5671</item_number>
<price>39.95</price>
<size description="Medium">
<color_swatch image="red_cardigan.jpg">Red</color_swatch>
<color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>
</size>
<size description="Large">
<color_swatch image="red_cardigan.jpg">Red</color_swatch>
<color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>
</size>
</catalog_item>
<catalog_item gender="Women's">
<item_number>RRX9856</item_number>
<price>42.50</price>
<size description="Small">
<color_swatch image="red_cardigan.jpg">Red</color_swatch>
<color_swatch image="navy_cardigan.jpg">Navy</color_swatch>
<color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>
</size>
<size description="Medium">
<color_swatch image="red_cardigan.jpg">Red</color_swatch>
<color_swatch image="navy_cardigan.jpg">Navy</color_swatch>
<color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>
<color_swatch image="black_cardigan.jpg">Black</color_swatch>
</size>
<size description="Large">
<color_swatch image="navy_cardigan.jpg">Navy</color_swatch>
<color_swatch image="black_cardigan.jpg">Black</color_swatch>
</size>
<size description="Extra Large">
<color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>
<color_swatch image="black_cardigan.jpg">Black</color_swatch>
</size>
</catalog_item>
</product>
<product description="Turkish Jeans" product_image="cardigan.jpg">
<catalog_item gender="Men's">
<item_number>FDE456</item_number>
<price>22</price>
<size description="Small">
<color_swatch image="red_cardigan.jpg">Blue</color_swatch>
<color_swatch image="burgundy_cardigan.jpg">Black</color_swatch>
</size>
<size description="Extra Small">
<color_swatch image="red_cardigan.jpg">White</color_swatch>
<color_swatch image="burgundy_cardigan.jpg">Transparent</color_swatch>
</size>
</catalog_item>
<catalog_item gender="Women's">
<item_number>LKO478</item_number>
<price>35</price>
<size description="Small">
<color_swatch image="red_cardigan.jpg">Red</color_swatch>
<color_swatch image="navy_cardigan.jpg">Blue</color_swatch>
<color_swatch image="burgundy_cardigan.jpg">Orange</color_swatch>
</size>
<size description="Large">
<color_swatch image="navy_cardigan.jpg">Navy</color_swatch>
<color_swatch image="black_cardigan.jpg">Black</color_swatch>
</size>
<size description="Extra Large">
<color_swatch image="burgundy_cardigan.jpg">Pink</color_swatch>
<color_swatch image="black_cardigan.jpg">Yellow</color_swatch>
</size>
</catalog_item>
</product>
</catalog>
catalog_mapping.ttl
@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix ex: <http://example.com/ns#>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#>.
@prefix transit: <http://vocab.org/transit/terms/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
rr:ProductMapping
rml:logicalSource [
rml:source "Catalogs.xml";
rml:referenceFormulation ql:XPath;
rml:iterator "/catalog/product"
];
rr:subjectMap [
rr:template "http://ex.com/{@description}";
rr:class ex:product
];
rr:predicateObjectMap [
rr:predicate ex:catalog_item;
rr:objectMap [
rr:parentTriplesMap rr:CatalogItemMapping;
rr:joinCondition [
rr:child "/catalog/product/catalog_item";
rr:parent "/catalog/product"
]
]
].
rr:CatalogItemMapping
rml:logicalSource [
rml:source "Catalogs.xml";
rml:referenceFormulation ql:XPath;
rml:iterator "/catalog/product/catalog_item"
];
rr:subjectMap [
rr:template "http://ex.com/{@gender}/id={item_number}";
];
rr:predicateObjectMap [
rr:predicate ex:item_number;
rr:objectMap [
rml:reference "item_number"
]
];
rr:predicateObjectMap [
rr:predicate ex:price;
rr:objectMap [
rml:reference "price"
]
];
rr:predicateObjectMap [
rr:predicate ex:size_and_color;
rr:objectMap [
rr:template "{size/@description}_{size/color_swatch}"
]
].
This is my current result......
<http://ex.com/Cardigan%20Sweater> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ns#product> null
<http://ex.com/Turkish%20Jeans> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/ns#product> null
<http://ex.com/Men%27s/id=QWZ5671> <http://example.com/ns#item_number> "QWZ5671" null
<http://ex.com/Men%27s/id=QWZ5671> <http://example.com/ns#price> "39.95" null
<http://ex.com/Men%27s/id=QWZ5671> <http://example.com/ns#size_and_color> <Medium_Red> null
<http://ex.com/Men%27s/id=QWZ5671> <http://example.com/ns#size_and_color> <Large_Red> null
<http://ex.com/Men%27s/id=QWZ5671> <http://example.com/ns#size_and_color> <Medium_Burgundy> null
<http://ex.com/Men%27s/id=QWZ5671> <http://example.com/ns#size_and_color> <Large_Burgundy> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#item_number> "RRX9856" null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#price> "42.50" null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Small_Red> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Medium_Red> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Large_Red> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Extra%20Large_Red> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Small_Navy> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Medium_Navy> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Large_Navy> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Extra%20Large_Navy> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Small_Burgundy> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Medium_Burgundy> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Large_Burgundy> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Extra%20Large_Burgundy> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Small_Black> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Medium_Black> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Large_Black> null
<http://ex.com/Women%27s/id=RRX9856> <http://example.com/ns#size_and_color> <Extra%20Large_Black> null
<http://ex.com/Men%27s/id=FDE456> <http://example.com/ns#item_number> "FDE456" null
<http://ex.com/Men%27s/id=FDE456> <http://example.com/ns#price> "22" null
<http://ex.com/Men%27s/id=FDE456> <http://example.com/ns#size_and_color> <Small_Blue> null
<http://ex.com/Men%27s/id=FDE456> <http://example.com/ns#size_and_color> <Extra%20Small_Blue> null
<http://ex.com/Men%27s/id=FDE456> <http://example.com/ns#size_and_color> <Small_Black> null
<http://ex.com/Men%27s/id=FDE456> <http://example.com/ns#size_and_color> <Extra%20Small_Black> null
<http://ex.com/Men%27s/id=FDE456> <http://example.com/ns#size_and_color> <Small_White> null
<http://ex.com/Men%27s/id=FDE456> <http://example.com/ns#size_and_color> <Extra%20Small_White> null
<http://ex.com/Men%27s/id=FDE456> <http://example.com/ns#size_and_color> <Small_Transparent> null
<http://ex.com/Men%27s/id=FDE456> <http://example.com/ns#size_and_color> <Extra%20Small_Transparent> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#item_number> "LKO478" null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#price> "35" null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Small_Red> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Large_Red> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Extra%20Large_Red> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Small_Blue> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Large_Blue> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Extra%20Large_Blue> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Small_Orange> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Large_Orange> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Extra%20Large_Orange> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Small_Navy> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Large_Navy> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Extra%20Large_Navy> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Small_Black> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Large_Black> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Extra%20Large_Black> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Small_Pink> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Large_Pink> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Extra%20Large_Pink> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Small_Yellow> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Large_Yellow> null
<http://ex.com/Women%27s/id=LKO478> <http://example.com/ns#size_and_color> <Extra%20Large_Yellow> null
Is this result good or is there a better catalog_mapping.ttl that can conclude a better result?