Open johardi opened 7 years ago
I think it would be good to reuse the Manchester syntax where possible. For example, rather than having
hasTotalFat {{@B* | xsd:decimal | mm:decimalFormat("##0.00")}}
you would have
hasTotalFat {{@B* | mm:decimalFormat("##0.00")}}^^xsd:decimal
Alternative use with an explicit split between data view and template view.
Rule view:
{
{ id: "individualIri",
iriEncode: "camelCase",
reference: "A*"
},
{ id: "productName",
reference: "A*"
},
{ id: "totalFat",
datatype: "xsd:decimal",
reference: "B*",
calc: function(x) {
return decimalFormat(x, "##0.000")
}
},
{ id: "saturatedFat",
datatype: "xsd:decimal",
reference: "C*",
calc: function(x) {
return decimalFormat(x, "##0.000")
}
},
{ id: "sugar",
datatype: "xsd:integer",
reference: "I*"
},
{ id: "sodium",
datatype: "xsd:decimal",
reference: "F*",
calc: function(x) {
return capturing(x, "([0-9]+)", "$1")
}
}
}
Rule Template:
Individual: {{individualIri}}
Types: NutritionalInformation
Facts: productName {{productName}},
hasTotalFat {{totalFat}},
hasSaturatedFat {{saturatedFat}},
hasSugar {{sugar}},
hasSodium {{sodium}}
The idea is that after evaluating the moustache templates, you're left with a valid Manchester Syntax document that could be loaded into Protege or any other tool that supports Manchester Syntax. Therefore, if something, like the datatype for a literal, is expressible in Manchester Syntax it should be expressed in Manchester Syntax and not in a way that only Cellfie/MappingMaster understands.
I agree if the purpose is for viewing compatibility between Manchester Syntax tools. But the evaluator (like MappingMaster) must understand the directives (e.g., datatype) to perform an action, and not just a string attached to the template {{...}}.
Eventually, after the evaluation, MappingMaster will produce a document like:
Individual: nutrition1
Types: NutritionalInformation
Facts: productName "Chocolate Fudge",
hasTotalFat "300.00"^^xsd:decimal,
hasSaturatedFat "20.99"^^xsd:decimal,
hasSugar "100"^^xsd:integer,
hasSodium "5"^^xsd:decimal
and any tools that support Manchester Syntax should be able to read it.
See here.
The translation to use the mustache template syntax is from this:
to this: