SemWeb.ModifiableSource

SemWeb : SemWeb Namespace
ModifiableSource Interface

This interface is implemented by data sources that support modifying the contents of the store.

public interface ModifiableSource : , SelectableSource, StatementSink

#### Remarks

Operations including Clear, Replace, and Remove are specified by this interface.

## Members

### Methods

| Clear () Clears the contents of the data store.
| Import (StatementSource) Loads the contents of a StatementSource into the data store.
| Remove (Statement) Removes statements from the data store.
| RemoveAll (Statement[]) Removes all statements matching an array of templates.
| Replace (Entity, Entity) Replaces all occurences of one Entity with another Entity.
| Replace (Statement, Statement) Replaces a single statement with another statement.

## Member Details

### Clear Method

public void Clear ()

Clears the contents of the data store.

#### Remarks

The data store is empty after a call to Clear.

### Import Method

public void Import (StatementSource source)

Loads the contents of a StatementSource into the data store.

#### Parameters

source
  The source whose statements will be added into the data store.

#### Remarks

This method wraps a call to SemWeb.StatementSource.Select(SemWeb.StatementSink) in store-specific code that prepares the store for receiving many statements. The store may make itself locked for access by other processes to make the parsing faster. To avoid this, call SemWeb.StatementSource.Select(SemWeb.StatementSink) directly.

### Remove Method

public void Remove (Statement template)

Removes statements from the data store.

#### Parameters

template
  A statement or statement template to remove from the data store.

#### Remarks

All statements in the data store that match template are removed. The template argument is a template. The non-`null` fields of template are used as a filter on the statements in the store. Statements that match the filter are removed. `null` fields of template are ignored during filtering. Any field in template (Subject, Predicate, Object, and Meta) may be `null`.

The following examples erase all statements in a store (although you should use SemWeb.ModifiableSource.Clear().

C# Example
    store.Remove(new Statement(null, null, null));
    store.Remove(Statement.All);

### RemoveAll Method

public void RemoveAll (Statement[] templates)

Removes all statements matching an array of templates.

#### Parameters

templates
  An array of statement templates. Statement templates may contain a `null` subject, predicate, object, and/or meta.

#### Remarks

Stores may be more efficient removing statements in one call than through repeated calls to SemWeb.ModifiableSource.Remove(SemWeb.Statement).

### Replace Method

public void Replace (Entity find, Entity replacement)

Replaces all occurences of one Entity with another Entity.

#### Parameters

find
  The Entity to search for in the store.
replacement
  The Entity to replace a.

#### Remarks

All occurences of find in statements in the store are replaced with references to replacement.

### Replace Method

public void Replace (Statement find, Statement replacement)

Replaces a single statement with another statement.

#### Parameters

find
  The statement to find. This parameter must be a complete statement (with subject, predicate, and object non-null), not a template.
replacement
  The statement that will replace the first statement.

#### Remarks

Store implementations may choose to optimize this method over a call to Remove followed by Add.