Skip to main content

pub.layers.graph

Generic typed property graph for knowledge representation and cross-referencing. Provides standalone graph nodes, typed directed edges between any Layers objects (within or across expressions, or to external knowledge graph nodes), and batch edge sets for efficient bulk operations. Enables cross-document coreference, intertextual linking, knowledge grounding, expression graphs (reply threads, translation chains, revision histories), temporal ordering (Allen's Interval Algebra), spatial relations (RCC-8 Region Connection Calculus), and arbitrary typed relationships.

Types

graphNode

Type: Record

A standalone graph node for entities, concepts, situations, or other objects that don't have another Layers record. Existing Layers records (expressions, annotations, typeDefs) are implicitly nodes via objectRef — this record is only needed for nodes that exist purely in the graph.

FieldTypeDescription
nodeTypeUriat-uriAT-URI of the node type definition node. Community-expandable via knowledge graph.
nodeTypestringNode type slug (fallback). Known values: entity, concept, situation, state, time, location, claim, proposition, custom
labelstringHuman-readable node label.
propertiesrefRef: pub.layers.defs#featureMap
knowledgeRefsarrayKnowledge graph references. Array of ref: pub.layers.defs#knowledgeRef
metadatarefRef: pub.layers.defs#annotationMetadata
createdAtdatetimeRecord creation timestamp.

graphEdge

Type: Record

A single directed, typed edge between any two Layers objects. Supports multidigraphs (multiple edges between the same pair of nodes) and cycles. Source and target can be any combination of local annotations (by UUID), remote records (by AT-URI), or external knowledge graph nodes (by knowledgeRef).

FieldTypeDescription
sourcerefSource node. Ref: pub.layers.defs#objectRef
targetrefTarget node. Ref: pub.layers.defs#objectRef
edgeTypeUriat-uriAT-URI of the edge type definition node. Community-expandable via knowledge graph.
edgeTypestringEdge type slug (fallback). See edge type categories below.
labelstringOptional edge label. For temporal edges, can carry the linguistic signal/connective (e.g., "before", "since"). For spatial edges, can carry the spatial signal (e.g., "in", "near", "above").
ordinalintegerOptional ordering among edges of the same type from the same source.
confidenceintegerConfidence score 0-10000.
propertiesrefRef: pub.layers.defs#featureMap
metadatarefRef: pub.layers.defs#annotationMetadata
createdAtdatetimeRecord creation timestamp.

Edge type categories

Communication: reply-to, quote, repost, translation-of, continuation, summary-of, revision-of, correction-of

Semantic: coreference, causal, part-of, member-of, type-of, same-as, related-to, derived-from

Argumentation: supports, contradicts

Discourse: discourse, bridging

Ontological: grounding, instance-of, denotes, describes, specializes, elaborates

Meta: produced-by, described-in, annotates, see-also

Temporal — Allen's Interval Algebra (13 basic relations):

Edge typeInverseDefinition
beforeafterSource ends before target starts (with gap)
afterbeforeSource starts after target ends (with gap)
meetsmet-bySource ends exactly when target starts
met-bymeetsSource starts exactly when target ends
overlapsoverlapped-bySource starts before target, ends during target
overlapped-byoverlapsSource starts during target, ends after target
startsstarted-bySource and target start together, source ends first
started-bystartsSource and target start together, target ends first
duringcontainsSource is entirely within target
containsduringTarget is entirely within source
finishesfinished-bySource and target end together, source starts later
finished-byfinishesSource and target end together, target starts later
equalsequalsSource and target have identical start and end

Temporal — TimeML extensions: simultaneous (looser than equals — allows partial overlap in practice)

Aspectual (TimeML ALINK): initiates, culminates, terminates, continues, reinitiates

Spatial — RCC-8 Region Connection Calculus (8 basic topological relations):

Edge typeInverseDefinition
disconnecteddisconnectedNo common points (symmetric)
externally-connectedexternally-connectedShare boundary only, interiors don't overlap (symmetric)
partially-overlappingpartially-overlappingSome interior overlap, neither contains the other (symmetric)
tangential-proper-parttangential-proper-part-inverseSource is inside target, boundaries touch
non-tangential-proper-partnon-tangential-proper-part-inverseSource is inside target, no boundary contact
tangential-proper-part-inversetangential-proper-partSource contains target, boundaries touch
non-tangential-proper-part-inversenon-tangential-proper-partSource contains target, no boundary contact
spatially-equalspatially-equalIdentical spatial extent (symmetric)

Spatial — Directional (ISO-Space orientational): north-of, south-of, east-of, west-of, above, below, in-front-of, behind, left-of, right-of

Spatial — Distance (ISO-Space metric): near, far, adjacent

Generic: custom

graphEdgeSet

Type: Record

A batch of typed, directed edges for efficient bulk operations. All edges in the set share the same edge type and optional expression context. Use graphEdge for individual edges; use graphEdgeSet for bulk imports, model outputs, or annotations that produce many edges at once.

FieldTypeDescription
expressionat-uriOptional primary expression context.
edgeTypeUriat-uriAT-URI of the edge type definition node. Community-expandable via knowledge graph.
edgeTypestringEdge type slug shared by all edges in this set (fallback). Same categories as graphEdge.edgeType.
edgesarrayThe edges. Array of ref: #graphEdgeEntry
metadatarefRef: pub.layers.defs#annotationMetadata
knowledgeRefsarrayKnowledge graph references. Array of ref: pub.layers.defs#knowledgeRef
featuresrefOpen-ended features (e.g., extraction method, model version). Ref: pub.layers.defs#featureMap
createdAtdatetimeRecord creation timestamp.

graphEdgeEntry

Type: Object

A single directed edge within a graphEdgeSet. Can optionally override the set-level edge type.

FieldTypeDescription
uuidrefRef: pub.layers.defs#uuid
edgeTypeUriat-uriAT-URI of the edge type definition node. Overrides the set-level type if present. Community-expandable via knowledge graph.
edgeTypestringEdge type slug (fallback).
sourcerefSource node. Ref: pub.layers.defs#objectRef
targetrefTarget node. Ref: pub.layers.defs#objectRef
confidenceintegerConfidence score 0-10000.
featuresrefRef: pub.layers.defs#featureMap