zazuko / xrm

A friendly language for mappings to RDF
MIT License
1 stars 0 forks source link

Implement formatting rules #10

Closed mchlrch closed 4 years ago

mchlrch commented 5 years ago

https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#formatting

nnamtug commented 4 years ago

struggeling with indentions. default lists come without indentions, e.g. 'referenceables': https://github.com/zazuko/rdf-mapping-dsl/blob/issue_10_formatter/runtime-EclipseXtext/airport-mapping/airport-sources.xrm#L5

if we want to see an indention, maybe we need to add markers like curly braces. see here on 'classes': https://github.com/zazuko/rdf-mapping-dsl/blob/issue_10_formatter/runtime-EclipseXtext/airport-mapping/vocabularies.xrm#L8

@mchlrch let's talk.

nnamtug commented 4 years ago

indentions are fine now.

is there any test data for a DialectGroup?

nnamtug commented 4 years ago

RdfMappingFormatter.xtend is full of warnings - unfortunately this is by design, thanks to itemis.

mchlrch commented 4 years ago

is there any test data for a DialectGroup?

Odd, it seems like we implemented a feature that nobody is using ... or it is used but kept as a secret ;-)

Anyhow. I found a default dialect description for CSV here: https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions

{
  "encoding": "utf-8",
  "lineTerminators": ["\r\n", "\n"],
  "quoteChar": "\"",
  "doubleQuote": true,
  "skipRows": 0,
  "commentPrefix": "#",
  "header": true,
  "headerRowCount": 1,
  "delimiter": ",",
  "skipColumns": 0,
  "skipBlankRows": false,
  "skipInitialSpace": false,
  "trim": false
}

In the DSL, this would look as follows:

dialect myCsvDialect {
    delimiter ","
    commentPrefix "#"
    doubleQuote true
    encoding "utf-8"
    header true
    headerRowCount 1
    lineTerminators "\\r\\n"
    quoteChar '\\"'
    skipBlankRows false
    skipColumns 0
    skipInitialSpace false
    skipRows 0
    trim false
}

That would be equivalent to the default, besides lineTerminators where we apparently only want to be able set one value, it seems.

So, that dialect could be added to one of the CSV example mappings, for example in elcom-strompreise