# plugins Package

## `plugins` Package

Default plugins for rdflib.

This is a namespace package and contains the default plugins for rdflib.

## `memory` Module

class `rdflib.plugins.memory.``Memory`(configuration=None, identifier=None)

  Bases: `rdflib.store.Store`

  An in memory implementation of a triple store.

  This triple store uses nested dictionaries to store triples. Each triple is stored in two such indices as follows spo[s][p][o] = 1 and pos[p][o][s] = 1.

  Authors: Michel Pelletier, Daniel Krech, Stefan Niederhauser

  `__init__`(configuration=None, identifier=None)

    identifier: URIRef of the Store. Defaults to CWD configuration: string containing infomation open can use to connect to datastore.

  `__len__`(context=None)

    Number of statements in the store. This should only account for non- quoted (asserted) statements if the context is not specified, otherwise it should return the number of statements in the formula or context given.

    Parameters: | context – a graph instance to query or None

  `__module__` = 'rdflib.plugins.memory'
  `add`(xxx_todo_changeme, context, quoted=False)

    Add a triple to the store of triples.

  `bind`(prefix, namespace)
  `namespace`(prefix)
  `namespaces`()
  `prefix`(namespace)
  `remove`(xxx_todo_changeme1, context=None)

    Remove the set of triples matching the pattern from the store

  `triples`(xxx_todo_changeme2, context=None)

    A generator over all the triples matching

class `rdflib.plugins.memory.``IOMemory`(configuration=None, identifier=None)

  Bases: `rdflib.store.Store`

  An integer-key-optimized context-aware in-memory store.

  Uses three dict indices (for subjects, objects and predicates) holding sets of triples. Context information is tracked in a separate dict, with the triple as key and a dict of {context: quoted} items as value. The context information is used to filter triple query results.

  Memory usage is low due to several optimizations. RDF nodes are not stored directly in the indices; instead, the indices hold integer keys and the actual nodes are only stored once in int-to-object and object-to-int mapping dictionaries. A default context is determined based on the first triple that is added to the store, and no context information is actually stored for subsequent other triples with the same context information.

  Most operations should be quite fast, but a triples() query with two bound parts requires a set intersection operation, which may be slow in some cases. When multiple contexts are used in the same store, filtering based on context has to be done after each query, which may also be slow.

  `__init__`(configuration=None, identifier=None)

    identifier: URIRef of the Store. Defaults to CWD configuration: string containing infomation open can use to connect to datastore.

  `__len__`(context=None)

    Number of statements in the store. This should only account for non- quoted (asserted) statements if the context is not specified, otherwise it should return the number of statements in the formula or context given.

    Parameters: | context – a graph instance to query or None

  `__module__` = 'rdflib.plugins.memory'
  `add`(triple, context, quoted=False)

    Adds the given statement to a specific context or to the model. The quoted argument is interpreted by formula-aware stores to indicate this statement is quoted/hypothetical It should be an error to not specify a context and have the quoted argument be True. It should also be an error for the quoted argument to be True when the store is not formula-aware.

  `add_graph`(graph)

    Add a graph to the store, no effect if the graph already exists. :param graph: a Graph instance

  `bind`(prefix, namespace)
  `context_aware` = True
  `contexts`(triple=None)

    Generator over all contexts in the graph. If triple is specified, a generator over all contexts the triple is in.

    if store is graph_aware, may also return empty contexts

    Returns: | a generator over Nodes

  `formula_aware` = True
  `graph_aware` = True
  `namespace`(prefix)
  `namespaces`()
  `prefix`(namespace)
  `remove`(triplepat, context=None)

    Remove the set of triples matching the pattern from the store

  `remove_graph`(graph)

    Remove a graph from the store, this shoud also remove all triples in the graph

    Parameters: | graphid – a Graph instance

  `triples`(triplein, context=None)

    A generator over all the triples matching the pattern. Pattern can include any objects for used for comparing against nodes in the store, for example, REGEXTerm, URIRef, Literal, BNode, Variable, Graph, QuotedGraph, Date? DateRange?

    Parameters: | context – A conjunctive query can be indicated by either

    providing a value of None, or a specific context can be queries by passing a Graph instance (if store is context aware).

## `sleepycat` Module

class `rdflib.plugins.sleepycat.``Sleepycat`(configuration=None, identifier=None)

  Bases: `rdflib.store.Store`

  `__init__`(configuration=None, identifier=None)

    identifier: URIRef of the Store. Defaults to CWD configuration: string containing infomation open can use to connect to datastore.

  `__len__`(context=None)

    Number of statements in the store. This should only account for non- quoted (asserted) statements if the context is not specified, otherwise it should return the number of statements in the formula or context given.

    Parameters: | context – a graph instance to query or None

  `__module__` = 'rdflib.plugins.sleepycat'
  `add`(triple, context, quoted=False, txn=None)

    Add a triple to the store of triples.

  `add_graph`(graph)

    Add a graph to the store, no effect if the graph already exists. :param graph: a Graph instance

  `bind`(prefix, namespace)
  `close`(commit_pending_transaction=False)

    This closes the database connection. The commit_pending_transaction parameter specifies whether to commit all pending transactions before closing (if the store is transactional).

  `context_aware` = True
  `contexts`(triple=None)

    Generator over all contexts in the graph. If triple is specified, a generator over all contexts the triple is in.

    if store is graph_aware, may also return empty contexts

    Returns: | a generator over Nodes

  `db_env` = None
  `formula_aware` = True
  `graph_aware` = True
  `identifier`
  `is_open`()
  `namespace`(prefix)
  `namespaces`()
  `open`(path, create=True)

    Opens the store specified by the configuration string. If create is True a store will be created if it does not already exist. If create is False and a store does not already exist an exception is raised. An exception is also raised if a store exists, but there is insufficient permissions to open the store. This should return one of: VALID_STORE, CORRUPTED_STORE, or NO_STORE

  `prefix`(namespace)
  `remove`(xxx_todo_changeme1, context, txn=None)

    Remove the set of triples matching the pattern from the store

  `remove_graph`(graph)

    Remove a graph from the store, this shoud also remove all triples in the graph

    Parameters: | graphid – a Graph instance

  `sync`()
  `transaction_aware` = False
  `triples`(xxx_todo_changeme2, context=None, txn=None)

    A generator over all the triples matching

## Subpackages

- parsers Package
  - `parsers` Package
  - `hturtle` Module
  - `notation3` Module
  - `nquads` Module
  - `nt` Module
  - `ntriples` Module
  - `rdfxml` Module
  - `structureddata` Module
  - `trix` Module
  - Subpackages
    - pyMicrodata Package
      - `pyMicrodata` Package
        - (Simple) Usage
          - Return formats
      - `microdata` Module
      - `registry` Module
      - `utils` Module
    - pyRdfa Package
      - `pyRdfa` Package
        - (Simple) Usage
          - Return (serialization) formats
        - Options
        - Host Languages
        - Vocabularies
          - Vocabulary caching
        - RDFa 1.1 vs. RDFa 1.0
        - Transformers
      - `embeddedRDF` Module
      - `initialcontext` Module
      - `options` Module
      - `parse` Module
      - `property` Module
      - `state` Module
      - `termorcurie` Module
      - `utils` Module
      - Subpackages
        - extras Package
          - `extras` Package
          - `httpheader` Module
        - host Package
          - `host` Package
          - `atom` Module
          - `html5` Module
        - rdfs Package
          - `rdfs` Package
          - `cache` Module
          - `process` Module
        - transform Package
          - `transform` Package
          - `DublinCore` Module
          - `OpenID` Module
          - `lite` Module
          - `metaname` Module
          - `prototype` Module
- serializers Package
  - `n3` Module
  - `nquads` Module
  - `nt` Module
  - `rdfxml` Module
  - `trig` Module
  - `trix` Module
  - `turtle` Module
  - `xmlwriter` Module
- sparql Package
  - `sparql` Package
  - `aggregates` Module
  - `algebra` Module
  - `compat` Module
  - `datatypes` Module
  - `evaluate` Module
  - `evalutils` Module
  - `operators` Module
  - `parser` Module
  - `parserutils` Module
  - `processor` Module
  - `sparql` Module
  - `update` Module
  - Subpackages
    - results Package
      - `csvresults` Module
      - `jsonlayer` Module
      - `jsonresults` Module
      - `rdfresults` Module
      - `tsvresults` Module
      - `xmlresults` Module
- stores Package
  - `stores` Package
  - `auditable` Module
  - `concurrent` Module
  - `regexmatching` Module
  - `sparqlstore` Module