What Export Formats Does Semantica Support? A Complete Guide to Knowledge Graph Exports

Semantica supports eight distinct export formats—JSON, CSV, Neo4j CSV, LPG (Label-Property Graph), ArangoDB collections, YAML, RDF/Turtle, and SHACL—each implemented as modular Python classes under the semantica/export/ package.

The semantica-agi/semantica repository provides a flexible export subsystem for persisting knowledge-graph data to various storage backends and file formats. Located in the semantica/export/ directory, this modular architecture allows developers to serialize entities and relationships using everything from simple flat files to semantic-web standards. Understanding the available export formats helps you integrate Semantica outputs with downstream analytics pipelines, graph databases, and validation frameworks.

Overview of Supported Export Formats

Semantica’s export capabilities cover four categories: document formats, tabular dumps, graph-native representations, and semantic-web standards.

Document and Tabular Formats

Graph Database Formats

Semantic Web and Validation Formats

  • RDF/Turtle (semantica/export/rdf_exporter.py): Standards-compliant RDF serialization via the RDFExporter class, enabling downstream SPARQL querying and linked-data publishing.

  • SHACL (semantica/export/shacl_exporter.py): Shape constraint generation via the SHACLExporter class for validating RDF graph structures against defined schemas.

How the Export Registry Works

The system uses a central registry pattern implemented in semantica/export/registry.py. This module maps method names (e.g., "json", "neo4j_csv", "rdf") to their corresponding exporter classes. The user-facing API in semantica/export/methods.py provides convenience functions that validate payload schemas—requiring a list of entity/relationship dictionaries—before delegating to the selected exporter.

Practical Code Examples

Export to JSON

from semantica.export import methods as export

# payload is a list of dicts representing entities and relationships

export.export_json(payload, "data/export.json")

This invokes the JSONExporter class from semantica/export/json_exporter.py, producing a language-agnostic snapshot of your knowledge graph.

Export to Neo4j-Compatible CSV

from semantica.export import methods as export

export.export_neo4j_csv(payload, "data/neo4j")

# Creates nodes.csv and relationships.csv in the specified directory

The Neo4jCSVExporter class in semantica/export/neo4j_csv_exporter.py handles the specific formatting requirements for Neo4j bulk imports, including proper header structures and relationship type columns.

Export to RDF (Turtle)

from semantica.export import methods as export

export.export_rdf(payload, "data/graph.ttl")

The RDFExporter class in semantica/export/rdf_exporter.py serializes the payload into Turtle format, making it compatible with semantic-web triple stores and SPARQL endpoints.

Generate SHACL Validation Shapes

from semantica.export import methods as export

export.export_shacl(payload, "data/shapes.ttl")

The SHACLExporter class in semantica/export/shacl_exporter.py generates constraint files that define validation rules for RDF graphs.

Key Source Files in the Export Subsystem

Understanding the repository structure helps when customizing or debugging exports:

Summary

  • Semantica provides eight export formats through modular exporters located in semantica/export/.
  • The registry pattern in registry.py decouples format implementation from the public API defined in methods.py.
  • Formats range from simple JSON/CSV to specialized graph databases (Neo4j, ArangoDB) and semantic-web standards (RDF, SHACL).
  • All exporters accept a standardized payload of entity/relationship dictionaries.
  • Use export_methods.export_<format>() for one-line serialization to your target format.

Frequently Asked Questions

What is the difference between the CSV and Neo4j CSV exporters?

The standard CSVExporter in semantica/export/csv_exporter.py produces flat tabular files suitable for spreadsheets and general data analysis. In contrast, Neo4jCSVExporter in semantica/export/neo4j_csv_exporter.py generates specifically formatted nodes.csv and relationships.csv files that comply with Neo4j’s LOAD CSV import requirements, including mandatory headers like :ID, :LABEL, :TYPE, and :START_ID/:END_ID columns.

Can I export directly to an ArangoDB instance?

Yes. The ArangoExporter class in semantica/export/arango_exporter.py supports direct export to ArangoDB collections using their native JSON-like document format. Unlike file-based exporters, this implementation can interface directly with the database API rather than producing intermediate files for manual import.

How does the export registry validate payloads?

The registry in semantica/export/registry.py ensures that incoming payloads conform to the expected schema—a list of dictionaries containing structured entity and relationship data—before instantiating the appropriate exporter class. This validation occurs within the helper functions defined in semantica/export/methods.py, preventing malformed data from reaching the serialization layer.

Which export format should I use for SPARQL querying?

Use the RDF/Turtle format via export_rdf() or the RDFExporter class in semantica/export/rdf_exporter.py. This produces standards-compliant RDF graphs that can be loaded into triple stores such as Apache Jena, GraphDB, or Virtuoso, enabling complex querying through the SPARQL protocol.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →