oldman.core.parsing.schema package¶
Submodules¶
oldman.core.parsing.schema.attribute module¶
-
class
oldman.core.parsing.schema.attribute.
OMAttributeExtractor
(property_extractors=None, attr_md_extractors=None, use_hydra=True, use_jsonld_context=True)[source]¶ Bases:
object
Extracts
OMAttribute
objects from the schema and the JSON-LD context.Extensible in two ways:
- New
OMPropertyExtractor
objects (new RDF vocabularies); - New
OMAttributeMdExtractor
objects (e.g. JSON-LD context); - New
ValueFormat
objects. See itsvalue_format_registry
attribute.
Parameters: - property_extractors – Defaults to [].
- attr_md_extractors – Defaults to [].
- use_hydra – Defaults to True.
- use_jsonld_context – Defaults to True.
-
extract
(class_iri, type_iris, context_js, schema_graph)[source]¶ Extracts metadata and generates
OMProperty
andOMAttribute
objects.Parameters: - class_iri – IRI of RDFS class of the future
Model
object. - type_iris – Ancestry of the RDFS class.
- context_js – the JSON-LD context.
- schema_graph –
rdflib.graph.Graph
object.
Returns: dict of
OMAttribute
objects.- class_iri – IRI of RDFS class of the future
-
value_format_registry
¶ ValueFormatRegistry
object.
- New
-
class
oldman.core.parsing.schema.attribute.
ValueFormatRegistry
(special_properties=None, include_default_datatypes=True, include_well_known_properties=True)[source]¶ Bases:
object
Finds the
ValueFormat
object that corresponds to aOMAttributeMetadata
object.New
ValueFormat
objects can be added, for supporting:- Specific properties (eg. foaf:mbox and
EmailValueFormat
); - Other datatypes, as defined in the JSON-LD context or the RDFS domain or range (eg. xsd:string).
Parameters: - special_properties – Defaults to {}.
- include_default_datatypes – Defaults to True.
- include_well_known_properties – Defaults to True.
-
add_datatype
(datatype_iri, value_format)[source]¶ Registers a
ValueFormat
object for a given datatype.Parameters: - datatype_iri – IRI of the datatype.
- value_format –
ValueFormat
object.
- Specific properties (eg. foaf:mbox and
oldman.core.parsing.schema.context module¶
-
class
oldman.core.parsing.schema.context.
JsonLdContextAttributeMdExtractor
[source]¶ Bases:
oldman.core.parsing.schema.context.OMAttributeMdExtractor
OMAttributeMdExtractor
objects that extract attribute names and datatypes from the JSON-LD context.
oldman.core.parsing.schema.property module¶
-
class
oldman.core.parsing.schema.property.
HydraPropertyExtractor
[source]¶ Bases:
oldman.core.parsing.schema.property.OMPropertyExtractor
OMPropertyExtractor
objects that support the Hydra vocabulary.- Currently, this class supports:
-
class
oldman.core.parsing.schema.property.
OMPropertyExtractor
[source]¶ Bases:
object
An
OMPropertyExtractor
object generates and updatesOMProperty
objects from the schema RDF graph.This class is generic and must derived for supporting various RDF vocabularies.
-
update
(om_properties, class_iri, type_iris, schema_graph)[source]¶ Generates new
OMProperty
objects or updates them from the schema graph.Parameters: - om_properties – dict of
OMProperty
objects indexed by their IRIs and their reverse status. - class_iri – IRI of RDFS class of the future
Model
object. - type_iris – Ancestry of the RDFS class.
- schema_graph –
rdflib.graph.Graph
object.
Returns: Updated dict
OMProperty
objects.- om_properties – dict of
-