Skip to main content

Document Transformation

Document transformation is the process of converting unstructured documents into structured graph data based on your ontology. This is a core capability of Graphora that allows you to extract meaningful entities and relationships from your documents.

The Transformation Process

When you submit documents to Graphora for transformation, the following steps occur:
1

Document Upload

Documents are uploaded to the Graphora platform and validated.
2

Parsing

Documents are parsed into a format that can be processed by the extraction pipeline.
3

Entity Extraction

Entities defined in your ontology are identified and extracted from the documents.
4

Relationship Extraction

Relationships between entities are identified based on the ontology definitions.
5

Validation

Extracted entities and relationships are validated against the ontology constraints.
6

Graph Construction

A graph is constructed from the validated entities and relationships.

Supported Document Types

Graphora supports a variety of document types for transformation:
  • Text files (.txt)
  • PDF documents (.pdf)
  • PPT documents (.ppt)
  • PPTX documents (.pptx)
  • Word documents (.doc)
  • Word documents (.docx)
  • CSV files (.csv)
  • JSON files (.json)
  • YAML files (.yaml)
  • XML files (.xml)

Transformation in the Client Library

The Graphora client library provides methods for transforming documents and monitoring the transformation process:

Transforming Documents

Checking Transformation Status

Retrieving the Transformed Graph

Transformation Stages

The transformation process goes through several stages, which you can monitor through the stage_progress field in the transformation status:

Handling Transformation Errors

If a transformation fails, you can check the error field in the transformation status:

Best Practices for Document Transformation

To get the best results from document transformation:
  1. Ensure your ontology is well-defined: The quality of extraction depends on your ontology
  2. Use appropriate document types: Different document types may yield different results
  3. Monitor transformation progress: Long documents may take time to process
  4. Handle errors gracefully: Check for and handle transformation errors
  5. Clean up after completion: Use cleanup_transform to remove temporary files

Example: Complete Transformation Workflow

Here’s a complete example of transforming documents and handling the results:

Next Steps