Lines 47-50
sub mint_uri {
Link Here
|
47 |
return $new_uri; |
47 |
return $new_uri; |
48 |
} |
48 |
} |
49 |
|
49 |
|
|
|
50 |
sub DelNamedGraph { |
51 |
my ($self, $args) = @_; |
52 |
my $model = $args->{model}; |
53 |
my $context = $args->{context}; |
54 |
if ($model && $context){ |
55 |
#Create a statement including variables to match everything with a given context (ie within a named graph), so that we can delete all these statements |
56 |
my $s = RDF::Trine::Node::Variable->new("s"); |
57 |
my $p = RDF::Trine::Node::Variable->new("p"); |
58 |
my $o = RDF::Trine::Node::Variable->new("o"); |
59 |
my $quad = RDF::Trine::Statement::Quad->new($s, $p, $o, $context); |
60 |
|
61 |
#Perform operations |
62 |
$model->remove_statements($quad); |
63 |
} |
64 |
} |
65 |
|
66 |
sub AddNamedGraph { |
67 |
my ($self, $args) = @_; |
68 |
my $model = $args->{model}; |
69 |
my $context = $args->{context}; |
70 |
my $iterator = $args->{iterator}; |
71 |
|
72 |
while (my $st = $iterator->next){ |
73 |
#Set the context (in order to populate the named graph) |
74 |
$st->context($context); |
75 |
|
76 |
$model->add_statement($st); |
77 |
#NOTE: This method returns undef on success. |
78 |
} |
79 |
} |
80 |
|
81 |
sub AddSeeAlso { |
82 |
my ($self, $args) = @_; |
83 |
my $model = $args->{model}; |
84 |
my $subject = $args->{subject}; |
85 |
my $predicate = RDF::Trine::Node::Resource->new("http://www.w3.org/2000/01/rdf-schema#seeAlso"); |
86 |
my $object = $args->{object}; |
87 |
if ($model && $subject && $predicate && $object){ |
88 |
my $statement = RDF::Trine::Statement->new($subject,$predicate,$object); |
89 |
$model->add_statement($statement); |
90 |
} |
91 |
} |
92 |
|
50 |
1; |
93 |
1; |
51 |
- |
|
|