To gain more control over the facts in a replica, Jinaga provides mechanisms for exporting facts as files. This allows you to back up your data, analyze it, or move it to other replicas.
Facts can be exported from different types of databases used by Jinaga:
jinaga-export-postgres
command-line tool.ExportFactsToJson
and ExportFactsToFactual
methods provided by the Jinaga library.In the following sections, we will provide detailed instructions on how to export facts from these different databases.
The JSON file format is used to export facts in a structured JSON format. This format is useful for data interchange and analysis using JSON-compatible tools.
[
{
"hash": "SV3Yseb0FJ/uQoL4IelHHbo1g4PZjnP4bx+aivMiiCkSTn2vSaNR6314KXL+PgO9lX9jmJzWoZABTRHjiFHWdQ==",
"type": "Blog.Post",
"predecessors": {
"site": {
"hash": "abc123",
"type": "Blog.Site"
}
},
"fields": {
"createdAt": "2023-04-28T23:53:00Z"
}
}
]
hash
: A unique identifier for the facttype
: The type of the factpredecessors
: An object containing references to predecessor facts
fields
: An object containing the fact's data fieldsThe Factual file format is used to export facts in a JavaScript-like fact declaration format. This format is useful for importing facts back into a Jinaga application or for sharing facts with other Jinaga users.
let f1: Blog.Site = {
domain: "example.com"
}
let f2: Blog.Post = {
createdAt: "2023-05-20T10:30:00Z",
site: f1
}
let f3: Blog.Post.Title = {
post: f2,
value: "My First Blog Post",
prior: []
}
<fact_id>
: A unique identifier for the fact<fact_type>
: The type of the fact<field_key>
and <field_value>
: The fact's data fields<predecessor_key>
and <predecessor_fact_id>
: References to single predecessor facts<predecessor_array_key>
: References to arrays of predecessor facts