lunisolar / LNKD.tech-Editor

Editor for Turtle (Terse RDF Triple Language, TTL) files. This is a plugin for IntelliJ IDEA, IDEA Community Edition and others IDE environments based on IntelliJ Platform (also described here)
https://plugins.jetbrains.com/plugin/12802-lnkd-tech-editor
4 stars 0 forks source link

Custom graph references unresolved despite completions working #16

Closed jakebeal closed 3 years ago

jakebeal commented 3 years ago

I'm building a file that makes use of a custom graph. I've added it to the LNKD.tech editor preferences, and know that this is working because I'm getting completions from the ontology in the editor.

All references, however, are still getting marked as unresolved reference warnings.

I'm running the 0.11.0 release in PyCharm 2021.1.2 (Community Edition) on a Mac.

lunisolar commented 3 years ago

Few questions:

jakebeal commented 3 years ago

Here is the custom graph I'm working with: https://github.com/dissys/sbol-owl3/blob/main/sbolowl3.rdf (I am using a local download of it). It's not very large, and I got no warnings.

lunisolar commented 3 years ago

This plugin does not support *.rdf (not yet).

Did you translate it to TTL? If so, could you attach it?

jakebeal commented 3 years ago

I didn't realize that it didn't support that format --- it didn't complain, so I'd guessed the plugin was just using a standard RDF library to consume all format. I have now run it through a converted to get TTL, which I've attached with an extra .txt adde so GitHub will allow it. The behavior is still the same: the plugin adds it to the list of custom graphs without objection, I get type completion, but unresolved reference errors.

sbolowl3-converted.ttl.txt

lunisolar commented 3 years ago

When you linked to the RDF document I tried to see how the IDE and plugin will behave - yes the plugin is missing the warning that only *.ttl file is supported in custom graphs. Regardless of the missing warning, the file appeared as a simple text file in the External Libraries. But in my reproduction it was just working as simple text file (IDE did not recognize the file). And therefore no highlighting in that file nor completion in other TTL files were subjected for that file.

I even tried to add the same RDF file as .rdf, .xml and .ttl (without translation) to see what happens. Well... nothing. Only the as .xml was working with highlighting - but that's just build in support for XML in IDE. IDE recognizes that only TTL file are supported by the plugin - and no indexing of any other than TTL were attempted - and failed - the same as it failed to open it because XML/RDF is not the TTL format. .

I will check the TTL file you attached - it should work without problem with my plugin. But given the previous behavior I start to wonder if there is no interaction from another plugin that tries to support cross language completion.

Questions:

jakebeal commented 3 years ago

Here's the top of one of the TTL files I'm working with:

@prefix : <http://bioprotocols.org/paml#> .
@prefix opil: <http://bioprotocols.org/opil/v1#> .
@prefix om: <http://www.ontology-of-units-of-measure.org/resource/om-2/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix paml: <http://bioprotocols.org/paml#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sbol: <http://sbols.org/v3#> .
@prefix uml: <http://bioprotocols.org/uml#> .
@prefix MathM: <http://www.w3.org/1998/Math/MathML> .
@base <http://bioprotocols.org/paml#> .

<http://bioprotocols.org/paml> rdf:type owl:Ontology ;
                              owl:imports uml:, sbol: , om: ;
                              rdfs:comment "Protocol Activity Modeling Languge (PAML) ontology." ;
                              owl:versionInfo "0.3" .

The owl:imports statement gives a warning Unresolved reference: http://sbols.org/v3# (it's doing the same for the others, but that's to be expected as SBOL is the first I tried to add). If I add one of the built-in namespaces like rdf or xsd to the import line, however, if gets no warning.

Here is what my external libraries preferences panel looks like: image

lunisolar commented 3 years ago

Actually I was talking about the project view - but now I think that you are not seeing that graph there. E.g: image

The question mark icon on your screenshot probably confirms what I also reproduced locally - the path of the custom graph in settings is wrong. It should be taken exactly as selected in "Select path". In my case the root of the path is replaced.

Can you confirm that in your case the file is actually in different path than displayed in your screen?

jakebeal commented 3 years ago

That's correct:

  1. The library is indeed not showing up in the project External Libraries.
  2. In the plugin screen, the initial '/Users' portion of the path appears to have been stripped off of what is listed. The true path is /Users/jakebeal/projects/SBOL/sbol-owl3/sbolowl3-converted.ttl
lunisolar commented 3 years ago

Thank you.

OK, then the ontology was never visible to the plugin not for completion nor for validations. Not sure what then suggested the completion.

BTW. There is a chance that if you enter the file name as "/Users/jakebeal/projects/SBOL/sbol-owl3/sbolowl3-converted.ttl" and not select from ~/ (user home) it should work - as a workaround. Worth a try - not sure how this path selection work on other systems.

In the mean time I found part of code that cuts of the begging of path.

jakebeal commented 3 years ago

Unfortunately, the plugin doesn't appear to offer me any ability to manually edit the path, only to select the file directly.

lunisolar commented 3 years ago

A just released version 0.11.1 should address the issue of the wrong path #19 (in addition to #20 #18 ).

The #17 however requires redefining how exactly (and if it is actually needed) the warning should work (but I think it is not priority and can wait for next version).

When you will be able to update (at convenient time), please drop comment if your original issue is solved.

jakebeal commented 3 years ago

0.11.1 does indeed allow me to use a custom graph, which fixes the unresolved references to terms from my ontology, and has the SBOL ontology show up in the external libraries collection.

The namespace declarations in the ontology are still coming across as unresolved, however. Here is the declaration:

<http://bioprotocols.org/uml> rdf:type owl:Ontology ;
                              owl:imports sbol:, opil:, om: ;
                              rdfs:comment "Unified Modeling Languge (UML) subset, translated to an SBOL factory ontology." ;
                              owl:versionInfo "1.0-alpha1" .

I would have expected the sbol: namespace to resolve now, given the prefix statement above:

@prefix sbol: <http://sbols.org/v3#> .

Is that the still-pending #17, or something else?

lunisolar commented 3 years ago

Yes, that would be #17. And what you presented is a good example. And I think in #17 i will remove warning altogether and just:

So instead of inspection there would be just information.

The main reason being that TTL's prefix declaration is not always a valid namespace (I think a concept that only applies for XML, and here just used for convenience), which in turn is not always ontology IRI.

What do you think?

jakebeal commented 3 years ago

I'd be OK with that.

lunisolar commented 3 years ago

Closing, as the only outstanding issue is delegated to its own ticket #17