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

config.ttl file syntax problem #5212

Open
mpagni12 opened this issue Nov 28, 2024 · 3 comments
Open

config.ttl file syntax problem #5212

mpagni12 opened this issue Nov 28, 2024 · 3 comments
Labels
🐞 bug issue is a bug

Comments

@mpagni12
Copy link

Current Behavior

This is a config.ttl file produced by the rdf4j-workbench (details about the repo don't matter):

@prefix config: <tag:rdf4j.org,2023:config/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<#TEST> a config:Repository;
  rdfs:label "TEST";
  config:rep.id "TEST";
  config:rep.impl [
      config:rep.type "openrdf:SailRepository";
      config:sail.impl [
          config:mem.persist true;
          config:sail.defaultQueryEvaluationMode "STRICT";
          config:sail.iterationCacheSyncThreshold "10000"^^xsd:long;
          config:sail.type "openrdf:MemoryStore"
        ]
    ] .

This config file cannot be used to create a new repo with the command

curl -H 'content-type: text/turtle' --upload-file config.ttl http://localhost:8080/rdf4j-server/repositories/TEST"

which yields the following error message

org.eclipse.rdf4j.rio.RDFParseException: Not a valid (absolute) IRI: #TEST

Expected Behavior

[] a config:Repository;

fixes the problem

Steps To Reproduce

see above

Version

eclipse/rdf4j-workbench 5.0.3

Are you interested in contributing a solution yourself?

Perhaps?

Anything else?

thank you for doing eclipse/rdf4j-workbench

@mpagni12 mpagni12 added the 🐞 bug issue is a bug label Nov 28, 2024
@hmottestad
Copy link
Contributor

hmottestad commented Nov 28, 2024

I assume that this here is the offending code:

RepositoryConfigRepository

			private Resource getContext(String repositoryID) {
				String location;
				try {
					location = manager.getLocation().toURI().toString();
				} catch (MalformedURLException | URISyntaxException e) {
					assert false;
					location = "urn:" + repositoryID;
				}
				String url = Protocol.getRepositoryLocation(location, repositoryID);
				return getValueFactory().createIRI(url + "#" + repositoryID);
			}

Maybe there should be a check that the second url there is actually a valid URI, or maybe we can just check if it's empty. In which case maybe we can use urn:, since it's a bit easier to deal with everything when we don't have to worry about blank nodes.

A general issue though is that this method is used both for creating the Resource for the first time and also for creating the same Resource later on to retrieve the correct repo from the config file.

@mpagni12
Copy link
Author

mpagni12 commented Dec 3, 2024

A general issue though is that this method is used both for creating the Resource for the first time and also for creating the same Resource later on to retrieve the correct repo from the config file.

Yes this is super useful to have such config file.

I understand the many difficulties with blank node, but for a config file I would say it is acceptable.

@hmottestad
Copy link
Contributor

I don't think a blank node would work. But it doesn't have to be a relative URL either like it seems to be at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug issue is a bug
Projects
None yet
Development

No branches or pull requests

2 participants