Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom dummy namespace doesn't work? #5

Closed
RolfBly opened this issue Apr 22, 2022 · 5 comments
Closed

Custom dummy namespace doesn't work? #5

RolfBly opened this issue Apr 22, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@RolfBly
Copy link

RolfBly commented Apr 22, 2022

using RDF transform v2.0.3-alpha with OR 3.5.2 and Java 17 in WSL Ubuntu 20.04

I've added abbrev ex for http://example.com/ as namespace and this is also my base IRI. It does not retrieve any real namespace, it doesn't need to.

The problem is that the abbrev does not show up in the preview nor the turtle. It looks like this:

@prefix : <http://example.com/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .

:mammals a skos:Concept;
  skos:narrower :felines, :bovines .

It should look like this:

@prefix ex: <http://example.com/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .

ex:mammals a skos:Concept;
  skos:narrower ex:felines, ex:bovines .

Should you have any hints as to how I can fix this myself by tweaking something (I don't know Java), please feel free to share.

In addition, I have to say I'm really happy that RDF Transform came along. Repeated occurrences (e.g. the two narrowers here) are a real pain in the neck to deal with in the "old" RDF-extension, see here.

@RolfBly
Copy link
Author

RolfBly commented Apr 23, 2022

If you define a base IRI and add it as a vocabulary, its abbreviation somehow gets wiped as it lands on line 1 in the turtle. See screenshot.

So the workaround for this problem is to just add abbreviations & vocabs that you do need to the vocab list, and put some dummy IRI that you never need in the base IRI. Then all you have to remember is to delete the first line in your turtle.
Schermafbeelding 2022-04-23 131343

@AtesComp
Copy link
Owner

AtesComp commented Apr 23, 2022

This issue is caused by the RDF4J library when it is used to generate the preview and export in Turtle. Both the base namespace and the prefixed namespace are registered with RDF4J in the code. However, the library is optimizing the output to use the base namespace over the prefixed namespace.

Issue: The Base IRI is used in various places as a "last ditch effort" to set or validated an IRI before throwing an error. The Base IRI should not be an "must have" requirement anyway.

In this case, we can exclude it from the export process. I'll code a condition for excluding the Base IRI when it is empty or a checkbox or something.

@RolfBly
Copy link
Author

RolfBly commented Apr 23, 2022

Expected behaviour comes from "the venerable RDF extension", where you define base URI + add it to vocabs with abbrev, and any object or subject of type URI gets that abbrev.

This is not to say that RDF Transform should work the same way, of course. Only to clarify.

I'm ok with ditching Base IRI altogether, I think the way it works in RDF Transform now is more intuitive/self-explanatory.

@AtesComp
Copy link
Owner

AtesComp commented Apr 23, 2022

The old RDF extension is probably preemptively overriding the Base IRI with the prefix if there is a same namespace and not giving the Base IRI to RDF4J. I probably missed that when I was "cleaning" the code. I'll review as a possible correction.

@AtesComp AtesComp added the enhancement New feature or request label Apr 24, 2022
@AtesComp AtesComp self-assigned this Apr 26, 2022
@AtesComp
Copy link
Owner

Fixed with commit 562a8d5

  1. Exclude use of BaseIRI as default namespace when it exists within the Prefixed Namespaces.
  2. Corrected and added debug messages.
  3. Updated the vocabulary manager dialog title (Defined Namespaces List)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants