-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#145 addind owl:versionInfo yyyy-mm-dd to imported and defined entiti…
…es through extracting date from related ontology versionIRIs
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
PREFIX : <http://www.test.com/ns/test#> | ||
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 dc: <http://purl.org/dc/elements/1.1/> | ||
|
||
INSERT { | ||
?individual owl:versionInfo ?versionStr . | ||
?class owl:versionInfo ?versionStr . | ||
} | ||
WHERE { | ||
?ontology rdf:type owl:Ontology ; | ||
owl:versionIRI ?versionIRI . | ||
# regex matches date and the previous text in the iri. When replaced string after the date remains | ||
BIND (REPLACE(str(?versionIRI), "^.*\\d{4}[\\-]\\d{2}[\\-]\\d{2}", "") AS ?dateTrailingStr) | ||
# regex matches date and the trailing text in the iri. When replaced string before the date remains | ||
BIND (REPLACE(str(?versionIRI), "\\d{4}[\\-]\\d{2}[\\-]\\d{2}.*$", "") AS ?dateHeadingStr) | ||
# replace heading and trailing text in the versionIRI to remain only the date | ||
BIND (REPLACE(str(?versionIRI), ?dateTrailingStr, "") AS ?versionSubStr) | ||
BIND (REPLACE(str(?versionSubStr), ?dateHeadingStr, "") AS ?versionStr) | ||
|
||
?class rdf:type owl:Class . | ||
OPTIONAL { ?individual rdf:type owl:NamedIndividual . FILTER NOT EXISTS {?individual owl:versionInfo ?o1} } | ||
FILTER (!isBlank(?class)) | ||
FILTER NOT EXISTS {?class owl:versionInfo ?o2} | ||
} |