spotterbase.records package
Submodules
spotterbase.records.jsonld_support module
- class spotterbase.records.jsonld_support.DefaultContexts
Bases:
object- classmethod append(ctx: JsonLdContext)
- classmethod get() list[JsonLdContext]
- classmethod get_converter(record_class_resolver: RecordClassResolver | None = None) JsonLdRecordConverter
- class spotterbase.records.jsonld_support.JsonLdContext(uri: Uri | None, namespaces: list[NameSpace], pred_infos: list[PredInfo], terms: list[tuple[str, Uri]])
Bases:
objectThis is a very crude implementation supporting only the necessary subset
- export_to_json() dict
- class spotterbase.records.jsonld_support.JsonLdRecordConverter(contexts: list[JsonLdContext], record_type_resolver: RecordClassResolver)
Bases:
object- classmethod default() JsonLdRecordConverter
spotterbase.records.rdf_to_jsonld module
- spotterbase.records.rdf_to_jsonld.main()
spotterbase.records.record module
- class spotterbase.records.record.AttrInfo(attr_name: 'str', pred_info: 'PredInfo', field_info: 'FieldInfo' = <spotterbase.records.record.FieldInfo object at 0x7eed12f489d0>, multi_field: 'bool' = False, literal_type: 'Optional[Uri]' = None)
Bases:
object- attr_name: str
- multi_field: bool = False
- class spotterbase.records.record.FieldInfo
Bases:
object
- class spotterbase.records.record.FieldRecordSet(record_types: 'set[type[Record]]')
Bases:
FieldInfo
- class spotterbase.records.record.PredInfo(uri: 'Uri', is_rdf_list: 'bool' = False, literal_type: 'Optional[Uri]' = None, is_reversed: 'bool' = False, json_ld_term: 'Optional[str]' = None, json_ld_type_is_id: 'bool' = False)
Bases:
object- is_rdf_list: bool = False
- is_reversed: bool = False
- json_ld_term: str | None = None
- json_ld_type_is_id: bool = False
- to_property_path() PropertyPath
- class spotterbase.records.record.Record(**kwargs)
Bases:
object- check_attrs()
- record_info: ClassVar[RecordInfo]
- class spotterbase.records.record.RecordInfo(record_type: Uri, attrs: list[AttrInfo], is_root_record: bool = False)
Bases:
object- is_root_record: bool
- class spotterbase.records.record.RecordMeta(*args)
Bases:
typeMetaclass for Record. Used for some basic checks.
- record_info: RecordInfo
spotterbase.records.record_class_resolver module
- class spotterbase.records.record_class_resolver.RecordClassResolver(record_types: Iterable[type[Record]] | None = None)
Bases:
object- classmethod merged(*record_class_resolvers: RecordClassResolver) RecordClassResolver
spotterbase.records.record_loading module
- spotterbase.records.record_loading.load_all_records_from_graph(endpoint: SparqlEndpoint, graph: Uri, populator: Populator) Iterator[Record]
spotterbase.records.record_to_python_source module
Code for generating the code that makes a record.
This is used in the documentation to show how to create a record in code.
spotterbase.records.sparql_populate module
- class spotterbase.records.sparql_populate.Populator(endpoint: SparqlEndpoint | None = None, *, record_type_resolver: RecordClassResolver = DefaultRecordClassResolver, special_populators: dict[type[Record], list[Callable[[list[tuple[Record, RootUri]], PropertyPath, Populator], None]]] | None = None, chunk_size: int = 1000)
Bases:
object
- class spotterbase.records.sparql_populate.RootUri
The RootUri of a record C is the Uri of the root record that C belongs to. The typical use case the following:
There is a root record R has a sub record C, which we want to populate. C might not have a URI associated with it. So to somehow reference it in SPARQL queries, we instead refer to R’s URI (the RootUri of C) and use a property path that leads from R to C.
alias of
Uri