Class GedcomConnector
- All Implemented Interfaces:
RelixConnector,AutoCloseable
One file holds many kinds of record, which is why this is a connection
rather than a file source: a CSV file is one relation and a .ged file is
several, and a connection is exactly the thing several tables share.
connection ancestry from gedcom { path: "family.ged" };
source Individuals from ancestry { table: "individuals",
schema: { id: STRING, name: STRING, surname: STRING, sex: STRING,
birth: { date: DATE, text: STRING, place: STRING } } };
Two tables
individuals and families. Their fields are
id, name, surname, sex, birth, death and
id, husband, wife, children respectively, where an event
(birth/death) has date, text and place, and
children is an array of individual ids.
The declared schema decides the heading
Every column is filled by name, at every level, and a column this connector has nothing for is NULL rather than an error. So a schema naming onlyid and name gets two columns, and one naming a nested
birth: { place: STRING } gets a one-field struct. That rule is what makes a
format as extensible as GEDCOM safe to declare a heading over: the file cannot widen
a relation behind the query's back.
A family is a hyperedge — two parents and any number of children —
so the binary parent→child edge the graph operators take is a projection over
μ children (families) rather than something this connector invents.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhandles()The type tokens this connector handles, lower-cased — e.g.open(ConnectorConfig config, String table, Schema schema) Opens a stream of rows for a named table/collection/endpoint.tableSchema(ConnectorConfig config, String table) Introspects the schema of a table, when the backend supports it.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.darkcollective.relix.processor.connector.RelixConnector
close, openQuery, tableStatistics
-
Constructor Details
-
GedcomConnector
public GedcomConnector()Public no-arg constructor required forServiceLoaderdiscovery.
-
-
Method Details
-
handles
Description copied from interface:RelixConnectorThe type tokens this connector handles, lower-cased — e.g.{"jdbc"},{"csv"},{"mongodb"}. The registry uses these for dispatch.- Specified by:
handlesin interfaceRelixConnector- Returns:
- a non-empty set of handled type tokens
-
tableSchema
Introspects the schema of a table, when the backend supports it. The default returns empty — "not available", in which case the declared schema is used as-is.GEDCOM's shape is fixed by the format rather than by the file, so both tables are described without opening anything. That is also what makes a declared schema optional rather than obligatory: a dotted reference resolves its columns here, and a script that wants fewer columns — or different names for them — still declares them.
Answering without reading the file means an unreadable or absent one does not stop analysis, which is the same degradation a database that will not connect gets.
- Specified by:
tableSchemain interfaceRelixConnector- Parameters:
config- the connector configurationtable- the table/collection name- Returns:
- the introspected schema, or empty when unavailable
-
open
Description copied from interface:RelixConnectorOpens a stream of rows for a named table/collection/endpoint. The caller closes the returned stream.- Specified by:
openin interfaceRelixConnector- Parameters:
config- the connector configuration for this relationtable- the table/collection/endpoint name within the sourceschema- the expected output schema (column order and types)- Returns:
- a stream of rows; the caller is responsible for closing it
-