What Is Export?
Export converts Semantica graph data into formats used by external tools and systems. Unlike internal persistence mechanisms that keep data within Semantica, export is specifically designed for interoperability with external consumers. Export vs. internal persistence:AgentContext.store()and graph persistence keep data inside Semantica for continued processing, retrieval, and reasoning- Export functions serialize graph data into standardized formats that external systems can consume directly
Why Use Export?
Build once, export many. Create your knowledge graph through Semantica’s extraction and reasoning workflows, then export the same graph data to multiple formats for different consumers without rebuilding or reprocessing. Interoperability with existing ecosystems. Connect Semantica graphs to established tools and workflows in your organization, from Neo4j graph databases to Gephi visualizations to pandas data analysis pipelines. Analytics and reporting workflows. Feed graph data into business intelligence tools, statistical analysis platforms, and machine learning pipelines that require specific data formats like CSV, Parquet, or RDF. Graph database migration and deployment. Move graphs from Semantica’s in-memory representation to production graph databases like Neo4j, ArangoDB, or triple stores for scalable query performance. RDF and semantic web integration. Export to semantic web standards (Turtle, JSON-LD, N-Triples) for integration with ontology tools, SPARQL endpoints, and semantic reasoning systems. Data lake and warehouse integration. Export to columnar formats like Parquet for integration with modern data stack tools including DuckDB, Apache Spark, and cloud data warehouses. Compliance and archival workflows. Generate standardized exports for regulatory submission, long-term archival, and audit trail requirements that mandate specific data formats.When To Use / When Not To Use
Use export when:- Integrating Semantica graphs with external systems and tools
- Sharing graph data with teams using different technology stacks
- Building analytics pipelines that consume graph data in downstream processing
- Working with RDF and ontology workflows requiring semantic web standards
- Creating reports, visualizations, and business intelligence dashboards
- Migrating graphs to production databases for scalable query performance
- Meeting compliance requirements for specific data format submissions
- You simply want to save and reload Semantica state—use built-in persistence mechanisms instead
- Agent persistence and memory continuity are your primary goals
- Internal retrieval, reasoning, and graph operations are sufficient for your use case
- Export would add unnecessary complexity to workflows that operate entirely within Semantica
- You need real-time access to evolving graph data—export creates static snapshots
- Your workflow involves iterative graph building, querying, and reasoning within Semantica
- You need to maintain agent memory, conversation history, and decision tracking
- Graph data will continue to be processed and enriched within Semantica workflows
export_rdf, export_graph, export_lpg, and related functions serialize a ContextGraph to any of ten formats in a single call, preserving node types, edge weights, and metadata faithfully. Use them when downstream consumers — triple stores, graph databases, visualization tools, ML pipelines, or spreadsheet auditors — each expect a different format from the same in-memory graph.
All export functions take
graph.to_dict() as their first argument — the same dict produced by ContextGraph.to_dict(). Build the graph once, export it to as many formats as you need without re-serializing. Note that graph.to_dict() materializes the entire graph in memory, so very large graphs may require additional memory planning.Building the Graph to Export
Before the first export, populate a graph. Every example below starts from this shared setup:RDF Formats — For Triple Stores and Semantic Reasoners
RDF (Resource Description Framework) is the foundational data model for the semantic web, representing information as subject-predicate-object triplets. RDF formats are essential for integration with semantic web technologies, ontology tools, and systems requiring formal knowledge representation. When your consumers are triple stores (GraphDB, Stardog, Apache Jena) or OWL reasoners (HermiT, Pellet), you want RDF. Semantica exports to all five standard RDF serializations through a singleexport_rdf call.
Graph Formats — For Gephi, Maltego, and Network Analysis
Labeled Property Graph (LPG) formats represent networks with typed nodes and edges that carry attributes and metadata. These formats are optimized for graph visualization tools and network analysis platforms that focus on exploring relationships and structural patterns. GraphML, GEXF, and DOT are the native formats of graph analysis and visualization tools. They preserve node attributes, edge weights, and type labels, so the graph you built in Semantica renders immediately in Gephi or NetworkX with full attribute data.Neo4j Cypher — For Graph-Pattern Threat Hunting
Cypher is Neo4j’s declarative graph query language that uses pattern matching to find and manipulate graph data. Cypher exports enable teams to run complex graph queries, pattern detection, and graph analytics using Neo4j’s optimized query engine. When the SOC team wants to run Cypher queries against the graph — finding threat actors that share infrastructure, or tracing multi-hop attack paths — you export to Cypher and load the result into Neo4j Desktop or Memgraph with a single command.CREATE and MATCH statements:
cypher-shell < threat_graph.cypher or drag the file into Neo4j Desktop’s import wizard. From that point, the SOC team can write Cypher queries without touching Python.
ArangoDB AQL — For Multi-Model Queries
ArangoDB combines graph traversal with document queries and full-text search in a single query language. When your compliance team needs to join the graph against structured regulatory documents, ArangoDB is the right backend.include_collection_creation=True flag means the AQL file is self-contained — it creates the collections before inserting data, so you can run it against a fresh ArangoDB instance without any prior setup.
CSV — For Spreadsheet Audits and Statistical Analysis
CSV (Comma-Separated Values) is a simple tabular format universally supported by spreadsheet applications, statistical tools, and data analysis platforms. CSV export flattens graph data into rows and columns for teams that work primarily with tabular data. The compliance team lives in Excel. The data science team lives in pandas. Both of them need CSV.export_csv writes the graph as flat rows — entities and relationships as separate files when you pass a base path.
Parquet — For Data Lakes and ML Pipelines
Parquet is a columnar storage format optimized for analytics workloads, offering efficient compression and fast query performance. Parquet files integrate seamlessly with modern data stack tools and machine learning frameworks. When the data science team runs feature engineering over graph attributes in DuckDB, Spark, or a lakehouse, Parquet is the format they want. It is columnar, compressed, and readable by every major ML framework.OWL — For Ontology-Based Reasoning
OWL (Web Ontology Language) is a semantic web standard for representing rich ontologies with classes, properties, and logical constraints. OWL enables automated reasoning, consistency checking, and inference over formal knowledge models. OntologyGenerator creates formal ontologies from graph data by analyzing entity types, relationships, and patterns to generate class hierarchies, property definitions, and logical constraints. This enables schema validation, automated reasoning, and integration with semantic web tools. When you have generated an OWL ontology from your graph usingOntologyGenerator, you can export it for Protégé, HermiT reasoning, or regulatory submission.
Common Pitfalls
Confusing export with persistence. Export creates external snapshots for interoperability, while persistence maintains Semantica’s internal state. Don’t use export when you need to save and reload agent memory or continue graph-based workflows—use built-in persistence mechanisms instead. Exporting stale graph data after graph changes. Always callgraph.to_dict() after your final graph modifications. If you store graph_data early in your workflow and then modify the graph, exports will reflect the outdated state, not your latest changes.
Re-running expensive extraction instead of reusing existing graph data. Build your graph once through entity extraction and relationship inference, then export to multiple formats using the same graph_data dict. Don’t rebuild the graph for each export format.
Choosing overly complex formats when CSV is sufficient. If downstream consumers work with tabular data and don’t need graph structure preservation, CSV is simpler, faster, and more universally supported than RDF or GraphML formats.
Assuming provenance and history automatically appear in exports. Standard export formats capture the current graph state but don’t include provenance chains, version history, or audit trails. Use dedicated provenance export mechanisms if you need full lineage information.
Ignoring downstream schema requirements. Different systems expect different identifier formats, attribute schemas, and relationship representations. Validate that your exported data matches the expectations of consuming systems before deploying to production workflows.
Exporting extremely large graphs without memory planning. The graph.to_dict() operation materializes the entire graph in memory. For very large graphs, monitor memory usage and consider chunking or streaming approaches for resource-constrained environments.
Domain Examples
- Defense — CTI/Threat
- Security — SOC/Incident
- Life Science — Clinical/Pharma
- Banking — Risk/Compliance
A CTI team needs the same threat graph in four places simultaneously: a SPARQL endpoint for cross-team queries, Gephi for the analyst briefing, Neo4j for graph-pattern threat hunting, and a JSON-LD feed for the SIEM ingestion pipeline. Four exports, one graph dict.
Choosing the Right Format
The format decision usually comes down to who is consuming the output and what tools they already use. If your consumer speaks SPARQL or uses a triple store, reach for Turtle (human review), N-Triples (bulk load), or JSON-LD (JSON-native pipelines). If they use a property graph database, Cypher goes to Neo4j or Memgraph; AQL goes to ArangoDB when they also need document and search queries in the same system. If they use a graph visualization tool, GraphML is the safest default with the widest tool support, GEXF gives richer attribute handling in Gephi specifically, and DOT is right when you need Graphviz to auto-render a static diagram. If they live in spreadsheets or statistical tools, CSV is the path of least resistance. If they run ML pipelines in DuckDB, Spark, or a lakehouse, Parquet is what they want. For semantic reasoning and ontology work, OWL/XML is the format — it is the only output that preserves the full class hierarchy for Protégé and HermiT.Related Guides
- Context Graphs — the
ContextGraphobject whoseto_dict()feeds all exports - Ontology Management — export OWL ontologies generated from your graph
- Reasoning & Rules — reasoning results can be exported as RDF triples
- Change Management — snapshot a graph before exporting to prove the export was made from a verified state
- Pipeline — chain ingest, extract, and export in a single
PipelineBuilder
