drepr.models.parsers.v1.sm_parser#

Classes

SMParser()

SM has the following schema

class SMParser[source]#

Bases: object

SM has the following schema

``` semantic_model:

data_nodes:

<attr_id>: <class_id>–<predicate>[^^<semantic type>] # other attributes

relations:
  • <source_class_id>–<predicate>–<target_class_id>

# other relations

literal_nodes:
  • <source_class_id>–<predicate>–<value>

subjects:

<class_id>: <attr_id>

prefixes:

<prefix>: <uri>

```

SM_KEYS = {'data_nodes', 'literal_nodes', 'prefixes', 'relations', 'subjects'}#
REG_SM_CLASS = re.compile('^((.+):\\d+)$')#
REG_SM_DNODE = re.compile('^((?:(?!--).)+:\\d+)--((?:(?!\\^\\^).)+)(?:\\^\\^(.+))?$')#
REG_SM_LNODE = re.compile('^((?:(?!--).)+:\\d+)--((?:(?!--).)+)--((?:(?!\\^\\^).)+)(?:\\^\\^(.+))?$')#
REG_SM_REL = re.compile('^((?:(?!--).)+:\\d+)--((?:(?!--).)+)--((?:(?!--).)+:\\d+)$')#
classmethod parse(sm: dict) SemanticModel[source]#
Parameters:

sm (dict) –

Return type:

SemanticModel