<?php

// scritto da michele D'onza
require_once "include/SparqleParkle_lib.php";
$clear = "CLEAR GRAPH<http://vitali.web.cs.unibo.it/raschietto/graph/ltw1521>";
sparql_insert_delete($clear, "ltw1521", "kaA{$e32P}");
示例#2
0
function deleteFunction($url, $tipo, $id, $start, $end)
{
    $prefix = 'prefix schema: <http://schema.org/> 
	prefix fabio: <http://purl.org/spar/fabio/> 
	prefix xsd:   <http://www.w3.org/2001/XMLSchema#> 
	prefix skos:  <http://www.w3.org/2009/08/skos-reference/skos.html> 
	prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> 
	prefix frbr:  <http://purl.org/vocab/frbr/core#> 
	prefix dlib:  <http://www.dlib.org/dlib/> 
	prefix deo:   <http://purl.org/spar/deo/> 
	prefix cito:  <http://purl.org/spar/cito/> 
	prefix sro:   <http://salt.semanticauthoring.org/ontologies/sro#> 
	prefix oa:    <http://www.w3.org/ns/oa#> 
	prefix rsch:  <http://vitali.web.cs.unibo.it/raschietto/> 
	prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
	prefix dcterms: <http://purl.org/dc/terms/> 
	prefix sem:   <http://www.ontologydesignpatterns.org/cp/owl/semiotics.owl#> 
	prefix foaf:  <http://xmlns.com/foaf/0.1/> 
	prefix prism: <http://prismstandard.org/namespaces/basic/2.0/> ';
    switch ($tipo) {
        case 'TT':
            $query = '
			WITH <http://vitali.web.cs.unibo.it/raschietto/graph/ltw1521>
							DELETE {
				                ?annotation ?p1 ?o1.
								?target ?p2 ?o2.
								?body ?p3 ?o3.
								?selector ?p4 ?o4.
			  					?obj ?p5 ?o5.
							}WHERE {
					        	?annotation a oa:Annotation;
									oa:hasTarget ?target;
									oa:hasBody ?body.
								?body rdf:object ?obj.
								?target	oa:hasSource ?src;
									oa:hasSelector ?selector.
								?annotation ?p1 ?o1.
								?target ?p2 ?o2.
								?body ?p3 ?o3.
								?selector ?p4 ?o4.
			   					OPTIONAL {
									?annotation rdfs:label "Citazione".
			    					?obj ?p5 ?o5
								}
								FILTER regex(str(?src),"' . $url . '")
				}';
            break;
        case "T":
            $query = '
				WITH <http://vitali.web.cs.unibo.it/raschietto/graph/ltw1521>
				DELETE {
	                ?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
				}WHERE {
					?annotation rdf:label "Titolo".
		        	?annotation a oa:Annotation;
						oa:hasTarget ?target;
						oa:hasBody ?body.
						?target	oa:hasSource ?src;
						oa:hasSelector ?selector.
						?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
						FILTER regex(str(?src),"' . $url . '")
				}';
            break;
        case "U":
            $query = 'WITH <http://vitali.web.cs.unibo.it/raschietto/graph/ltw1521>
				DELETE {
	                ?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
				}WHERE {
					?annotation redf:label "URL".
		        	?annotation a oa:Annotation;
						oa:hasTarget ?target;
						oa:hasBody ?body.
						?target	oa:hasSource ?src;
						oa:hasSelector ?selector.
						?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
						FILTER regex(str(?src),"' . $url . '")
				}';
            break;
        case "R":
            $query = 'WITH <http://vitali.web.cs.unibo.it/raschietto/graph/ltw1521>
				DELETE {
	                ?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
				}WHERE {
					?annotation redf:label "Retorica".
		        	?annotation a oa:Annotation;
						oa:hasTarget ?target;
						oa:hasBody ?body.
						?target	oa:hasSource ?src;
						oa:hasSelector ?selector.
						?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
						FILTER regex(str(?src),"' . $url . '")
				}';
            break;
        case "D":
            $query = 'WITH <http://vitali.web.cs.unibo.it/raschietto/graph/ltw1521>
				DELETE {
	                ?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
				}WHERE {
					?annotation redf:label "DOI".
		        	?annotation a oa:Annotation;
						oa:hasTarget ?target;
						oa:hasBody ?body.
						?target	oa:hasSource ?src;
						oa:hasSelector ?selector.
						?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
						FILTER regex(str(?src),"' . $url . '")
				}';
            break;
        case "A":
            $query = 'WITH <http://vitali.web.cs.unibo.it/raschietto/graph/ltw1521>
				DELETE {
	                ?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
				}WHERE {
					?annotation redf:label "Autore".
		        	?annotation a oa:Annotation;
						oa:hasTarget ?target;
						oa:hasBody ?body.
						?target	oa:hasSource ?src;
						oa:hasSelector ?selector.
						?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
						FILTER regex(str(?src),"' . $url . '")
				}';
            break;
        case "CIT":
            $query = 'WITH <http://vitali.web.cs.unibo.it/raschietto/graph/ltw1521>
				DELETE {
	                ?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
				}WHERE {
					?annotation redf:label "Citazione".
		        	?annotation a oa:Annotation;
						oa:hasTarget ?target;
						oa:hasBody ?body.
						?target	oa:hasSource ?src;
						oa:hasSelector ?selector.
						?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
						FILTER regex(str(?src),"' . $url . '")
				}';
            break;
        case "ANN":
            $query = ' WITH <http://vitali.web.cs.unibo.it/raschietto/graph/ltw1521>
				DELETE {
	                ?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
				}WHERE {
					?annotation redf:label "Anno di pubblicazione".
		        	?annotation a oa:Annotation;
						oa:hasTarget ?target;
						oa:hasBody ?body.
						?target	oa:hasSource ?src;
						oa:hasSelector ?selector.
						?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
						FILTER regex(str(?src),"' . $url . '")
				}';
            break;
        case "C":
            $query = 'WITH <http://vitali.web.cs.unibo.it/raschietto/graph/ltw1521>
				DELETE {
	                ?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
				}WHERE {
					?annotation redf:label "Commento".
		        	?annotation a oa:Annotation;
						oa:hasTarget ?target;
						oa:hasBody ?body.
						?target	oa:hasSource ?src;
						oa:hasSelector ?selector.
						?annotation ?p1 ?o1.
					?target ?p2 ?o2.
						?body ?p3 ?o3.
						?selector ?p4 ?o4.
						FILTER regex(str(?src),"' . $url . '")
				}';
            break;
    }
    $query = $prefix . $query;
    sparql_insert_delete($query, 'ltw1521', 'kaA$e32P');
    return $query;
}