Datasets:
PREFIX d3f: <http://d3fend.mitre.org/ontologies/d3fend.owl#> | |
PREFIX dcterms: <http://purl.org/dc/terms/> | |
PREFIX owl: <http://www.w3.org/2002/07/owl#> | |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> | |
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |
CONSTRUCT { | |
?s ?p ?new_o . | |
} | |
WHERE { | |
?s ?p ?o . | |
# Transform rdfs:seeAlso strings that are valid QNames into URIs | |
BIND( | |
IF( | |
?p = rdfs:seeAlso && isLiteral(?o) && REGEX(STR(?o), "^d3f:([a-zA-Z_][a-zA-Z0-9_]*)$"), | |
URI(REPLACE(STR(?o), "^d3f:", STR(d3f:))), | |
?o | |
) AS ?new_o | |
) | |
FILTER (?p NOT IN ( | |
d3f:d3fend-data-property, | |
d3f:d3fend-kb-data-property, | |
d3f:d3fend-kb-object-property, | |
d3f:d3fend-object-property, | |
d3f:todo | |
) | |
) | |
FILTER ( | |
!isLiteral(?new_o) || (isLiteral(?new_o) && STRLEN(STR(?new_o)) > 0) | |
) | |
FILTER ( | |
!(?p = rdfs:seeAlso && isLiteral(?new_o) && !REGEX(STR(?new_o), "^d3f:([a-zA-Z_][a-zA-Z0-9_]*)$")) | |
) | |
} | |