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:
objectExtracts
OMAttributeobjects from the schema and the JSON-LD context.Extensible in two ways:
- New
OMPropertyExtractorobjects (new RDF vocabularies); - New
OMAttributeMdExtractorobjects (e.g. JSON-LD context); - New
ValueFormatobjects. See itsvalue_format_registryattribute.
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
OMPropertyandOMAttributeobjects.Parameters: - class_iri – IRI of RDFS class of the future
Modelobject. - type_iris – Ancestry of the RDFS class.
- context_js – the JSON-LD context.
- schema_graph –
rdflib.graph.Graphobject.
Returns: dict of
OMAttributeobjects.- class_iri – IRI of RDFS class of the future
-
value_format_registry¶ ValueFormatRegistryobject.
- New
-
class
oldman.core.parsing.schema.attribute.ValueFormatRegistry(special_properties=None, include_default_datatypes=True, include_well_known_properties=True)[source]¶ Bases:
objectFinds the
ValueFormatobject that corresponds to aOMAttributeMetadataobject.New
ValueFormatobjects 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
ValueFormatobject for a given datatype.Parameters: - datatype_iri – IRI of the datatype.
- value_format –
ValueFormatobject.
- 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.OMAttributeMdExtractorOMAttributeMdExtractorobjects 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.OMPropertyExtractorOMPropertyExtractorobjects that support the Hydra vocabulary.- Currently, this class supports:
-
class
oldman.core.parsing.schema.property.OMPropertyExtractor[source]¶ Bases:
objectAn
OMPropertyExtractorobject generates and updatesOMPropertyobjects 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
OMPropertyobjects or updates them from the schema graph.Parameters: - om_properties – dict of
OMPropertyobjects indexed by their IRIs and their reverse status. - class_iri – IRI of RDFS class of the future
Modelobject. - type_iris – Ancestry of the RDFS class.
- schema_graph –
rdflib.graph.Graphobject.
Returns: Updated dict
OMPropertyobjects.- om_properties – dict of
-