graflo.hq.rdf_landing¶
Land RDF facts on a manifest: read each class a resource handles from a file.
Facts extracted from documents arrive as an RDF file of instances (an ABox),
often with the ontology they were extracted against in a second file.
:func:land_rdf_facts turns them into manifest blocks:
- A manifest with a schema and resources keeps both. Every class in the facts
whose local name is a resource gets a :class:
SparqlConnectorover the facts file (re-landing the same class replaces its connector); the other classes are reported asunbound. - A manifest without them takes schema, resources and bindings inferred from
the ontology (:class:
RdfInferenceManager), every connector reading the facts file.
Attributes¶
__all__ = ['LandedClass', 'RdfLanding', 'fact_classes', 'land_rdf_facts']
module-attribute
¶
Classes¶
LandedClass
¶
RdfLanding
¶
Bases: ConfigBaseModel
The manifest with the facts landed, and what landed where.
Source code in graflo/hq/rdf_landing.py
Attributes¶
bound = Field(default_factory=list, description='Classes now read from the facts file')
class-attribute
instance-attribute
¶
manifest
instance-attribute
¶
unbound = Field(default_factory=list, description='Classes in the facts that no resource of the manifest handles')
class-attribute
instance-attribute
¶
Functions:¶
fact_classes(facts)
¶
Domain classes instantiated in facts, with instance counts, in IRI order.
Source code in graflo/hq/rdf_landing.py
land_rdf_facts(manifest, facts, *, ontology=None, db_flavor=DBType.ARANGO)
¶
Return manifest with facts bound to the resources that handle them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest
|
GraphManifest | None
|
The manifest to land on; |
required |
facts
|
Path
|
RDF file of instances. Its path is written into the connectors as given, so pass the path the ingesting process will read. |
required |
ontology
|
Path | None
|
RDF file declaring the classes. Required when the manifest has
no schema; otherwise used only to read multi-range properties by
class ( |
None
|
db_flavor
|
DBType
|
Target flavour of a schema inferred from the ontology. |
ARANGO
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The manifest has no schema and no ontology was given. |