Skip to content

feat: add rdf n-tripples graph load source#7

Open
VanyaGlazunov wants to merge 3 commits intomainfrom
feat-add-rdf-graph-load
Open

feat: add rdf n-tripples graph load source#7
VanyaGlazunov wants to merge 3 commits intomainfrom
feat-add-rdf-graph-load

Conversation

@VanyaGlazunov
Copy link
Copy Markdown
Collaborator

Adds support for loading graphs from RDF N-Triples format as a new edge source.

closes #3 I think.

@VanyaGlazunov VanyaGlazunov force-pushed the feat-add-rdf-graph-load branch 2 times, most recently from e470334 to 9b98673 Compare March 19, 2026 02:54
@VanyaGlazunov VanyaGlazunov force-pushed the feat-add-rdf-graph-load branch from 9b98673 to 7fbc869 Compare March 19, 2026 04:31
}
}

impl<R: Read> Iterator for NTriples<R> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

<...> <http://a.org/knows> <...>
<...> <http://b.org/knows> <...>

We lose info about difference between these two predicates if use LocalName. Is it good?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Decided to get rid of local name extraction strategy and stick to fulliri always

} else if let Some(pos) = iri.rfind('/') {
iri[pos + 1..].to_owned()
} else {
iri.to_owned()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we obtain something like <...> <http://a.org/> <...>? In this case predicate will be empty "". Should we handle this case?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Same as above answer

@suvorovrain
Copy link
Copy Markdown
Collaborator

@VanyaGlazunov Nice. Can you answer on my questions in review?

}

#[cfg(test)]
mod tests {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you, please, introduce a test involving non-ascii chars. Especially I am interested in Chinese and Cyrillic support.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added test with russain and chinese alice and bob

Copy link
Copy Markdown
Member

@georgiy-belyanin georgiy-belyanin left a comment

Choose a reason for hiding this comment

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

Thank you for working on this! Consider, please, my comment and Rodion's one.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new RDF N-Triples format parser and wires it into the in-memory graph builder so graphs can be loaded directly from .nt sources (per Issue #3).

Changes:

  • Introduces formats::nt::NTriples<R> iterator (backed by oxttl) to parse N-Triples into Edge items.
  • Adds GraphSource<InMemoryBuilder> support for NTriples<R> and a corresponding in-memory loading test.
  • Updates formats module exports and repo documentation to include the new format.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/graph/mod.rs Minor formatting adjustment in check_graph signature.
src/graph/inmemory.rs Imports NTriples, implements GraphSource for it, and adds an in-memory load test.
src/formats/nt.rs New N-Triples parser/iterator implementation with label-extraction strategy and unit tests.
src/formats/mod.rs Exposes nt module + NTriples re-export; extends FormatError with N-Triples-related variants.
AGENTS.md Documents the new nt.rs format module and usage details.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@VanyaGlazunov VanyaGlazunov force-pushed the feat-add-rdf-graph-load branch from 58506ae to db21f19 Compare March 31, 2026 08:31
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.

RDF N-Triples graph data loading

4 participants