Skip to content

Conversation

@gouttegd
Copy link
Contributor

This PR ensures that, when seeding, if the project is configured to use a context, the initial context file is created in src/ontology/config, where the Makefile expects to find it.

While we are at it, and related, we fix two small issues with the #1148 PR:

  • The context.csv file is a file that is derived from the context.json file; as such, it should be written into the tmp directory, rather than into the config directory. Having such a file in config could lead users to think they can (or are even expected to) edit that file, while they are only supposed to edit the context.json file.

  • The target to create a SQLite file should depend on the CSV context file only when the project is configured to use a context.

The _dynamic_files.jinja2 template is creating the context.json file
(list of prefixes used in the project) in src/config, but the standard
Makefile is expecting to find that file in src/ontology/config.

We amend the template to create the file at the location where the
Makefile expects to find it.

closes #1146
When building a SQLite product, we need to transform the JSON-formatted
src/ontology/config/context.json file into a CSV variant, for the
benefit of the semsql tool.

Since the CSV file is a derived file that people are not supposed to
edit (the source of truth is the JSON file), it is better to put that
file in the temporary directory rather than the config directory.
If the project is not configured to use a context, then the target to
produce .db files does not need to depend on $(CONTEXT_FILE_CSV).

This still works because, without a context, the CONTEXT_FILE_CSV
variable is never declared, so it expands to nothing. But it is cleaner
to avoid relying on this.
@gouttegd gouttegd self-assigned this Nov 29, 2024
Copy link
Contributor

@matentzn matentzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great!

@gouttegd gouttegd merged commit 98aca97 into master Nov 29, 2024
1 check passed
@gouttegd gouttegd deleted the fix-context-location branch November 29, 2024 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants