Closed ThomasPause closed 4 years ago
Happens in ob and bb:
select distinct ?g
{
graph ?g
{ ?s ?p ?page.}
filter(regex(str(?p),"page","i"))
filter(regex(str(?page),","))
}
First, delete empty pages:
sparql
with <http://www.snik.eu/ontology/ob>
delete
{
?s ?p ?page.
}
{
?s ?p ?page.
filter(regex(str(?p),"page","i"))
filter(str(?page)="")
}
sparql
with <http://www.snik.eu/ontology/bb>
delete
{
?s ?p ?page.
}
{
?s ?p ?page.
filter(regex(str(?p),"page","i"))
filter(str(?page)="")
}
sparql
with <http://www.snik.eu/ontology/he-unconsolidated>
delete
{
?s ?p ?page.
}
insert
{
?s ?p ?pagep.
}
where
{
?s ?p ?page.
filter(regex(str(?p),"page","i"))
bind(STRDT(str(?page),xsd:positiveInteger) as ?pagep)
}
Other graphs analogously.
construct
{
?s ?p ?before.
?s ?p ?after.
}
from sniko:ob
where
{
?s ?p ?page.
filter(regex(str(?p),"page","i"))
filter(regex(str(?page),","))
BIND(strdt(strbefore(replace(?page," ",""),","),xsd:positiveInteger) as ?before)
BIND(strdt(strafter(replace(?page," ",""),","),xsd:positiveInteger) as ?after)
}
sparql
with <http://www.snik.eu/ontology/ob>
delete
{
?s ?p ?page.
}
insert
{
?s ?p ?before.
?s ?p ?after.
}
where
{
?s ?p ?page.
filter(regex(str(?p),"page","i"))
filter(regex(str(?page),","))
BIND(strdt(strbefore(replace(?page," ",""),","),xsd:positiveInteger) as ?before)
BIND(strdt(strafter(replace(?page," ",""),","),xsd:positiveInteger) as ?after)
}
sparql
with <http://www.snik.eu/ontology/bb>
delete
{
?s ?p ?page.
}
insert
{
?s ?p ?before.
?s ?p ?after.
}
where
{
?s ?p ?page.
filter(regex(str(?p),"page","i"))
filter(regex(str(?page),","))
BIND(strdt(strbefore(replace(?page," ",""),","),xsd:positiveInteger) as ?before)
BIND(strdt(strafter(replace(?page," ",""),","),xsd:positiveInteger) as ?after)
}
Now we have some page triples that don't match the datatype:
select distinct ?p ?page
{
?s ?p ?page.
filter(regex(str(?p),"page","i"))
filter(xsd:int(?page)!=?page)
}
Fix foaf:homepage
sparql
with <http://www.snik.eu/ontology/bb>
delete
{
?s ?p "http://www.snik.eu"^^<http://www.w3.org/2001/XMLSchema#positiveInteger>.
}
insert
{
?s ?p <http://www.snik.eu>.
}
where
{
?s ?p "http://www.snik.eu"^^<http://www.w3.org/2001/XMLSchema#positiveInteger>.
}
Analogously for the other graphs.
For unknown reasons, the conductor does not execute the following query without an error message, so the "manuell hinzugefügt" triples stay with the incorrect datatype for now:
sparql
with <http://www.snik.eu/ontology/bb>
delete
{
?s ?p "manuell hinzugefügt"^^<http://www.w3.org/2001/XMLSchema#positiveInteger>.
}
insert
{
?s ?p "manuell hinzugefügt".
}
where
{
?s ?p "manuell hinzugefügt"^^<http://www.w3.org/2001/XMLSchema#positiveInteger>.
}
Pages should be integers, comma separated literals such as "123, 345" are thus invalid. Split those up into two triples.