-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirectGraphHandler.cs
42 lines (37 loc) · 1.05 KB
/
DirectGraphHandler.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using VDS.RDF;
using VDS.RDF.Parsing.Handlers;
namespace IS4.SFI.RDF
{
/// <summary>
/// Represents an <see cref="IRdfHandler"/> that asserts triples directly
/// into a graph.
/// </summary>
public class DirectGraphHandler : BaseRdfHandler
{
readonly IGraph graph;
/// <summary>
/// Creates a new instance of the handler.
/// </summary>
/// <param name="graph">The graph to assert to.</param>
public DirectGraphHandler(IGraph graph) : base(graph)
{
this.graph = graph;
}
/// <inheritdoc/>
public override bool AcceptsAll => true;
/// <inheritdoc/>
protected override bool HandleTripleInternal(Triple t)
{
return graph.Assert(t);
}
/// <inheritdoc/>
protected override bool HandleQuadInternal(Triple t, IRefNode graph)
{
if(graph.Equals(this.graph.Name))
{
return HandleTripleInternal(t);
}
return true;
}
}
}