Repository navigation
Add CLI integration tests for create, query and view; fix OWL RL entailment across --data files - #27
Merged
Merged
Conversation
Covers what the per-subcommand suites didn't check end to end: - view: header statistics, graph IRI metadata, several files, and missing or non-HDT input. - create: every accepted RDF serialization yields the same graph; failed creates exit non-zero and leave no output or temp files; named graphs merge only with --allow-merge-named-graphs. - query: CONSTRUCT in every RDF format, ASK in every results format, OWL RL entailment, --named-graph bindings, mixed HDT and RDF inputs, several --sparql files, error exits, and --debug-query-plan. Multi-line expected results are committed under tests/goldens/. test_query_owl_rl_entailment_across_data_files is #[ignore]d: entailment is computed per --data file, so an ontology in a separate file is never applied to the data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With --entailment owl-rl, each --data file was prepared, and its closure computed, on its own, so an ontology in one file never applied to the data in another: `--data data.ttl ontology.ttl` inferred nothing. The default graph is the merge of its files, so when entailment is on and it has more than one file, prepare them together with handle_files, which already computes one closure over all its inputs. Each named graph keeps a closure of its own, and without entailment preparation is unchanged. test_query_owl_rl_entailment_across_data_files is no longer ignored, and now covers the ontology as Turtle and as HDT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GregHanson
marked this pull request as ready for review
November 5, 2026 19:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #26. These tests cover what the per-subcommand suites didn't check end to end, measured against the test methodology:
All 20 new tests use committed fixtures and temporary directories. One of them found a bug in OWL RL entailment, which the second commit fixes (see The entailment fix).
view (
tests/test-view.rs, +4)test_view_reports_header_statisticsviewoutput names the file and reports triple, subject and predicate counts. The oldtest_viewwrote to/dev/nulland only checked that it didn't error.test_view_shows_graph_iri_metadatacreate --graph-irishows up inview, and is absent without it.test_view_lists_each_filetest_view_cli_rejects_missing_and_non_hdt_filescreate (
tests/test-create.rs, +3)test_create_accepts_each_rdf_serializationde.test_create_cli_failures_leave_nothing_behindTMPDIRbeyond hdt's shared lock directory.test_create_cli_merges_named_graphs_only_when_allowed--allow-merge-named-graphsand merge with it.query (
tests/test-query.rs, +9)test_query_construct_in_each_rdf_formattest_query_ask_result_formatstest_query_owl_rl_entailment--entailment owl-rlinfersBanana a FoodfromFruit rdfs:subClassOf Food, with data and ontology in one HDT; nothing is inferred with entailment off.test_query_owl_rl_entailment_across_data_files--datafile, as Turtle and as HDT. Failed before the fix below.test_query_cli_named_graph_bindings--named-graph IRI=PATHfeedsGRAPH ?g, and--datadoesn't leak into the named graphs.test_query_mixed_hdt_and_rdf_inputstest_query_cli_runs_each_sparql_file_in_order--sparqlfiles each print their own result, in order.test_query_cli_errorstest_query_cli_debug_query_plan--debug-query-planwrites JSON to stderr and leaves stdout unchanged.The entailment fix
Before:
de query --data banana.ttl fruit-ontology.ttl --entailment owl-rlinferred nothing.prepare_source_hdt_pathprepared each--datafile throughhandle_fileson its own, so each file got its own closure, and an ontology in one file never applied to the data in another. It only worked when the data and the ontology were in the same file or HDT. The per-file preparation dates from #7.After:
prepare_default_graph_hdt_pathsprepares them together throughhandle_files, which already computes a single closure over all its inputs.--named-graph, orFROM NAMED) keeps a closure of its own, as SPARQL entailment applies to the active graph. An ontology in the default graph doesn't add inferences inside a named graph.Checked:
TMPDIRbeyond hdt's lock directory.Also found while writing these
de create --output-name /no/such/dir/x.hdt …fails withNo such file or directory (os error 2), without naming the path. The test asserts only that message, so it can be tightened when the message names the path.dcterms:issued), so two runs on the same input differ. A reproducibility test would have to compare everything but the header, so this PR doesn't add one.Left for later
tests/goldens/.FROM/FROM NAMEDwith local files is unit-tested insrc/query.rsbut has no CLI test yet.Checked locally
cargo fmt --check.cargo clippy --workspace --all-targets -- -D warnings -W clippy::pedantic, with and without--all-features.cargo nextest run --profile ci: 83 passed.cargo machete: no unused dependencies.--test test-serve: 15 passed.--test w3c-sparql: 1,913 pass, 0 fail, 94 unsupported, as onmain.🤖 Generated with Claude Code