zazuko / xrm

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

Code assist generates invalid code #67

Closed vhf closed 4 years ago

vhf commented 4 years ago

Probably related to #12

Here is my example DSL (using current master, e04332df4c4d84fe848a15e547afd128b69a7197):

output r2rml

map TriplesMap1 from EMPLOYEE {
    subject template "http://data.example.com/employee/{0}" with EMPNO;

    types
        ex:Employee
        // HERE

    properties
        ex:name from ENAME;
}

// database: table and columns 
logical-source EMPLOYEE {
    type rdb
    source "EMP"

    referenceables
        EMPNO
        ENAME
}

// vocabulary: classes and properties
vocabulary ex {
    prefix "ex:" "http://example.com/ns#"

    classes
        Employee

    properties
        name
}

vocabulary schema {
    prefix "schema:" "http://schema.org"

    classes
        Test
}

One L8, typing sch suggests schema.Test, accepting the suggestion inserts schema.Test, then validation kicks in and tells me schema.Test is invalid (should be schema:Test instead).

mchlrch commented 4 years ago

I tested this in Eclipse, there it works as expected. It suggests and auto-completes schema:Test.

vhf commented 4 years ago

Could it have something to do with this: https://github.com/zazuko/rdf-mapping-dsl/blob/074edee1f9d278d04507ecffe90c50ca67066005/com.zazuko.rdfmapping.dsl.parent/com.zazuko.rdfmapping.dsl/src/com/zazuko/rdfmapping/dsl/RdfMapping.xtext#L169-L173 ?

The DSL tells me schema.Test is a RdfClass but I have no way of checking what this: https://github.com/zazuko/rdf-mapping-dsl/blob/074edee1f9d278d04507ecffe90c50ca67066005/com.zazuko.rdfmapping.dsl.parent/com.zazuko.rdfmapping.dsl.ui/src/com/zazuko/rdfmapping/dsl/ui/contentassist/RealRdfMappingProposalProvider.java#L42-L46 returns

mchlrch commented 4 years ago

The code that enables RdfPrefixedName is a customization of the default Xtext behavior (#12). The theia integration is based on the language server artifact that Xtext builds and it's possible that this customization doesn't make it into the code of the language server artifact. Or maybe the code is in there, but not wired or not active for some reason.

There are two runtime platforms, Eclipse and theia. They differ. The "plugins" for the two platforms have some overlap, but differ as well. The native Eclipse based plugins are not based on the language server, for example.

I guess debugging the language server and comparing with the Eclipse native behavior is necessary, if we want to know what's going on

vhf commented 4 years ago

According to @ktk the DSL syntax with : is a hack that relies on Eclipse and that's why it cannot be part of the LSP.

ktk commented 4 years ago

From what I understood it is not part of XText core, that's why it's not part of the LSP. So I think we should consider taking that "feature" out again as it will probably be something we would have to take care of in whatever environment we work in.

mchlrch commented 4 years ago

The feature with the : delimiter now is disabled on the master branch. Only . is used as delimiter everywhere.

vhf commented 4 years ago

Thanks!