The surf.plugin.reader Module

class surf.plugin.reader.RDFReader(*args, **kwargs)[source]

Bases: surf.plugin.Plugin

Super class for all surf Reader plugins.

close()

Close the plugin and free any resources it may hold

concept(resource)[source]

Return the concept URI of the following resource.

resource can be a string or a URIRef. :param resource: the given resource :type resource: surf.resource.Resource

get(resource, attribute, direct)[source]

Return the value(s) of the corresponding attribute.

Parameters:
  • resource (surf.resource.Resource) – the given resource
  • attribute (str) – the given attribute
  • direct (bool) – whether the attribute is a direct or inverse edge / property. If False then the subject of the resource is considered the object of the query.
Returns:

the value(s) of the corresponding attribute

Return type:

list

inference

Toggle logical inference on / off. The property has any effect only if such functionality is supported by the underlying surf.store.Store store

instances_by_attribute(resource, attributes, direct, context)[source]

Return all URIs that are instances of resource and have the specified attributes.

If direct is False, than the subject of the resource is considered the object of the query.

is_present(resource)[source]

Check whether the resource is present in the underlying surf.store.Store store

Parameters:resource (surf.resource.Resource) – the given resource
load(resource, direct)[source]

Fully load the resource from the underlying surf.store.Store store. This method returns all statements about the resource.

If direct is False, then the subject of the resource is considered the object of the query

Parameters:
  • resource (surf.resource.Resource) – the given resource
  • direct (bool) – whether the attribute is a direct or inverse edge / property. If False then the subject of the resource is considered the object of the query.
Returns:

all statements about resource

Return type:

dict