RDFParser

class apis_core.helper_functions.RDFParser.RDFParser(uri, kind, app_label_entities='apis_entities', app_label_relations='apis_relations', app_label_vocabularies='apis_vocabularies', rdf_settings='/workspace/apis-core/apis_core/helper_functions/../default_settings/RDF_default_settings.yml', uri_settings='/workspace/apis-core/apis_core/helper_functions/../default_settings/URI_replace_settings.yml', preserve_uri_minutes=5, use_preferred=False, uri_check=True, **kwargs)[source]
Parameters:
  • uri – (url) Uri to parse the object from (http://test.at). The uri must start with a base url mentioned in the RDF parser settings file.

  • kind – (string) Kind of entity (Person, Place, Institution, Work, Event)

  • app_label_entities – (string) Name of the Django app that contains the entities that we create.

  • app_label_relations – (string) Name of the Django app that contains the relations for the merging process.

  • app_label_vocabularies – (string) Name of the Django app that contains the vocabularies defining the entities and relations.

  • use_preferred – (boolean) if True forwards to preferred sources defined in sameAs

create_objct(depth=2)[source]

Uses parsed attributes to create an object that is not yet persisted to the db. Stores the object in self.objct :param depth: (int) depth to follow

get_or_create(depth=2)[source]

Gets or creates object with given URI and entity type. :param depth: (int) depth of related objects to be followed :return: (object) created object

merge(m_obj, app_label_relations='apis_relations')[source]
Parameters:
  • m_obj – the object to merge into (must be an django model object instance)

  • app_label_relations – (string) the label of the Django app that contains the relations

Returns:

django object saved to db or False if nothing was saved

save()[source]

Saves specified object to DB if it doesnt exist yet :return: django object saved to db or False if nothing was saved