Add read_rdf_prefixes() table function for RDF namespace introspection#35
Open
nonodename wants to merge 3 commits intomainfrom
Open
Add read_rdf_prefixes() table function for RDF namespace introspection#35nonodename wants to merge 3 commits intomainfrom
nonodename wants to merge 3 commits intomainfrom
Conversation
Returns @Prefix and @base declarations from Turtle and TriG files as a 3-column table: prefix (VARCHAR, NULL for @base), uri (VARCHAR), is_base (BOOLEAN). Supports the same strict_parsing, file_type, and include_filenames parameters as read_rdf(), and glob patterns. Throws InvalidInputException for NTriples, NQuads, RDF/XML, and unknown file types at bind time for clean error propagation. - src/read_rdf_prefixes.cpp — core implementation - src/include/read_rdf_prefixes.hpp — registration header - test/sql/read_rdf_prefixes.test — 30 test assertions - CMakeLists.txt — add new source file - src/rdf_extension.cpp — register function in LoadInternal() - docs/functions.md — function reference documentation - README.md — usage section with example output - TODO.md — mark item #3 as complete https://claude.ai/code/session_01VZXDXseqTYk3vvxypTwQYw
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.
Summary
This PR adds a new
read_rdf_prefixes()table function that extracts@prefixand@basedeclarations from Turtle and TriG RDF files. This enables namespace introspection, documentation generation, and building CURIE-aware tooling without parsing full RDF triples.Key Changes
New table function
read_rdf_prefixes(): Reads one or more Turtle or TriG files and returns their prefix/base declarations as rows with columns:prefix(VARCHAR, NULL for @base),uri(VARCHAR), andis_base(BOOLEAN)File format support:
file_typeparameterParameters:
path: File path or glob pattern (required)strict_parsing: Boolean flag (default true) to control error handling for malformed contentfile_type: Override format detection (values:ttl,turtle,trig)include_filenames: Boolean flag (default false) to add a 4thfilenamecolumn showing source fileImplementation details:
Documentation: Added comprehensive function documentation to
docs/functions.mdand usage examples toREADME.mdTests: Added 20+ test cases covering basic functionality, glob patterns, file type validation, error cases, and parameter combinations
Notable Implementation Details
PrefixBaseCallback,PrefixNameCallback) to extract only prefix declarations without parsing full RDF statementsPrefixRowvector approach ensures thread-safe, single-threaded scanning with atomic position trackingITriplesBuffer::FileTypeand detection logic)https://claude.ai/code/session_01VZXDXseqTYk3vvxypTwQYw