-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove.php
45 lines (39 loc) · 1.23 KB
/
remove.php
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
43
44
45
<?php
// ----------------------------------------------------------------------------------
// RAP Net API Remove Operaton
// ----------------------------------------------------------------------------------
/**
* The remove operation allows the user to delete statements from a model on the server.
*
*
* @version $Id: remove.php 268 2006-05-15 05:28:09Z tgauss $
* @author Phil Dawes <[email protected]>
*
* @package netapi
* @todo nothing
* @access public
*/
function removeFromModel($model,$contenttype,$postdata){
$p = getParser($contenttype);
$m = $p->parse2model($postdata);
$it = $m->getStatementIterator();
while ($it->hasNext()){
$statement = $it->next();
$model->remove($statement);
}
echo "200 - The data has been removed from the model.";
}
function getParser($contenttype){
if ($contenttype == "application/n-triples"){
$p = new N3Parser();
} elseif ($contenttype == "application/n3"){
$p = new N3Parser();
} elseif ($contenttype == "application/rdf+xml"){
$p = new RdfParser();
} else {
header('HTTP/1.0 415 Unsupported Media Type');
die("415 - I don't understand content type. Accepted content types are application/n-triples, application/n3, application/rdf+xml.");
}
return $p;
}
?>