zazuko / xrm

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

Populate index with vocabularies from (non-DSL) file contents #72

Closed mchlrch closed 3 years ago

mchlrch commented 4 years ago

Same goal as described in #14, but using another approach. It should be possible to use existing vocabularies in the mapping-dsl by dropping a file with RDF serialization of the vocabulary in the mapping project.

For example N-Quads for SKOS: https://github.com/zazuko/rdf-vocabularies/blob/master/ontologies/skos.nq

mchlrch commented 4 years ago

A (small) subset of the SKOS vocabulary would be specified in the DSL as follows:

vocabulary skos {
    prefix "skos" "http://www.w3.org/2004/02/skos/core#"

    classes
        Concept

    properties
        notation
}

In the N-Quad file linked above (skos.nq), we can find the following statements.

Concept is-a Class, defined-by http://www.w3.org/2004/02/skos/core ontology.

<http://www.w3.org/2004/02/skos/core#Concept> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> <http://www.w3.org/2004/02/skos/core#> .
<http://www.w3.org/2004/02/skos/core#Concept> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://www.w3.org/2004/02/skos/core> <http://www.w3.org/2004/02/skos/core#> .

notation is-a Property, defined-by http://www.w3.org/2004/02/skos/core ontology.

<http://www.w3.org/2004/02/skos/core#notation> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> <http://www.w3.org/2004/02/skos/core#> .
<http://www.w3.org/2004/02/skos/core#notation> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://www.w3.org/2004/02/skos/core> <http://www.w3.org/2004/02/skos/core#> .

I saw that the Prefix-Label for the vocabulary is unfortunately not defined in the ontology itself, so we will have to provide that somehow alongside the ontology. Maybe something like _index.nq can be used, as it contains metadata about the ontologies, also Prefix-Label and Prefix-IRI

ktk commented 4 years ago

@mchlrch we do that separately, see https://github.com/zazuko/rdf-vocabularies/issues/27

ktk commented 4 years ago

Ah I did not read that properly, you did find the file :)

nnamtug commented 4 years ago

Here an update for documentation purpose:

The basic idea to provide objects on Xtext index. Xtext does this in order to make EObjects referenceable. The "only" thing is to look into the projects org.eclipse.xtext.*.ecore and turn into a copycat (says Christian Dietrich from xtext). The catch: This topic simply covers every topic that eclipse has to offer in this area: osgi, xtext, emf, guice, maven, tycho.

In order to check the source project from xtext, install eclipse for commiters and checkout all the xtext projects (needs github account and time).

So I turned into a copycat and provided these modules:

Limitation This approach is valid for publishing EMF from files in Xtext index. This makes these models referencable from Xtext grammars. If an nq-file changes, the index gets updated on save. This solution can be re-used for any type of file based fanin. But: Reading data from another resource than a file, e.g. a REST resource, is not covered at all. I assume it would be even quite different. Finding such a solution would probably require a serious amount of engineering.

Assessment This solution...

nnamtug commented 4 years ago

Next steps:

nnamtug commented 4 years ago

Notes on navigation into nq-editor:

  1. parsing, store locationInformation as adapter ( GrammarToDomainConverter, see where using PositionAdapter)
  2. publish locationInformation in IEObjectDescription ( NqFaninResourceDescriptionStrategy extends DefaultResourceDescriptionStrategy --> userData)
  3. in editor opener, read locationInfo ( NqFaninEditorOpener, using @Inject IResourceDescriptions, PositionAdapter )
nnamtug commented 4 years ago

Notes on RdfMappingCore.ecore: Instances of RdfClass and RdfProperty now may origin from different sources. Since there are references to these elements without the same syntax for any source type. This implies to have a common ecore model, the RdfMappingCore.ecore. It is referenced by NqFanin.ecore and RdfMapping.ecore. Both concrete models provide instances of RdfMappingCore.

mchlrch commented 3 years ago

If Eclipse is the target runtime platform for the editor, this approach works well.

As the focus is shifting more and more towards the LSP based editor, we want to avoid adding integrations with Eclipse runtime.

I'm closing this issue

(the code of this prototype is on branch issue_72_index)