-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #268 from opengeospatial/20231204_geosparql
second geosparql 1.1 upload
- Loading branch information
Showing
30 changed files
with
37,333 additions
and
0 deletions.
There are no files selected for viewing
6,284 changes: 6,284 additions & 0 deletions
6,284
incubation/geosparql/20231206_delete_geosparqlfiles.nt
Large diffs are not rendered by default.
Oops, something went wrong.
7,678 changes: 7,678 additions & 0 deletions
7,678
incubation/geosparql/20231206_insert_geosparqlfiles.nt
Large diffs are not rendered by default.
Oops, something went wrong.
88 changes: 88 additions & 0 deletions
88
incubation/geosparql/second_attempt/merge_def_ttl_files_to_add.py
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,88 @@ | ||
import os, re | ||
import rdflib | ||
from rdflib.namespace import DC, DCTERMS, DOAP, FOAF, SKOS, OWL, RDF, RDFS, VOID, XMLNS, XSD | ||
|
||
|
||
path = "/Users/ogckm/Documents/GitHub/NamingAuthority/incubation/geosparql/second_attempt/triples_to_add" | ||
|
||
g = rdflib.Graph() | ||
|
||
for dirpath, subdirs, files in os.walk(path): | ||
for name in files: | ||
if name.endswith(".ttl"): | ||
print(os.path.join(dirpath, name)) | ||
g.parse(os.path.join(dirpath, name)) | ||
|
||
|
||
g.serialize(destination="/Users/ogckm/Documents/GitHub/NamingAuthority/incubation/geosparql/20231206_insert_geosparqlfiles.nt",format="nt") | ||
|
||
''' | ||
The code below is not used because it is incomplete. | ||
g1 = rdflib.Graph() | ||
g1.parse("file:///Users/ogckm/Documents/GitHub/NamingAuthority/incubation/geosparql/20231206_insert_geosparqlfiles.nt") | ||
knows_query = """ | ||
SELECT DISTINCT ?subject { | ||
?subject ?predicate ?object | ||
FILTER (isURI(?subject) && STRSTARTS(str(?subject), str('http://www.opengis.net/def/') ) ) | ||
}""" | ||
all_def_uris = [] | ||
qres = g1.query(knows_query) | ||
for row in qres: | ||
all_def_uris.append(f"{row.subject}") | ||
fout2 = open('/Users/ogckm/Documents/GitHub/NamingAuthority/incubation/geosparql/20231206_insert_geosparqlfiles_step2_not_uploaded.nt','w') | ||
for subject in all_def_uris: | ||
is_concept = False | ||
triple_to_check = "<"+subject+"> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept>." | ||
qres = g1.query("ASK {"+triple_to_check+"}") | ||
for row in qres: | ||
if str(row) == 'False': | ||
print(subject + " NOT Concept" + str(row)) | ||
else: | ||
is_concept = True | ||
if is_concept == False: | ||
triple_to_check = "<"+subject+"> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#ConceptScheme>." | ||
qres = g1.query("ASK {"+triple_to_check+"}") | ||
for row in qres: | ||
if str(row) == 'False': | ||
if is_concept is False: | ||
print(subject + " NOT ConceptScheme" + str(row)) | ||
fout2.write(triple_to_check+"\n") | ||
fout2.close() | ||
''' | ||
|
||
''' | ||
legacy instructions - no longer necessary | ||
FIRST START FUSEKI | ||
/Users/ogckm/Tools/apache-jena-fuseki-4.5.0/fuseki-server --file "/Users/ogckm/Downloads/20231206_insert_geosparqlfiles.nt" /geosparql | ||
THEN EXPORT ALL definition triples to all_defs_queryResults.ttl with this: | ||
CONSTRUCT {?subject ?predicate ?object} WHERE { | ||
?subject ?predicate ?object | ||
FILTER (isURI(?subject) && STRSTARTS(str(?subject), str('http://www.opengis.net/def/') ) ) | ||
} | ||
Then export distinct def URIs to distinct_def_uris.csv with this: | ||
SELECT DISTINCT ?subject { | ||
?subject ?predicate ?object | ||
FILTER (isURI(?subject) && STRSTARTS(str(?subject), str('http://www.opengis.net/def/') ) ) | ||
} | ||
''' | ||
|
57 changes: 57 additions & 0 deletions
57
incubation/geosparql/second_attempt/merge_def_ttl_files_to_clear.py
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,57 @@ | ||
import os, re | ||
import rdflib | ||
from rdflib.namespace import DC, DCTERMS, DOAP, FOAF, SKOS, OWL, RDF, RDFS, VOID, XMLNS, XSD | ||
|
||
|
||
folderpath = "/Users/gobehobona/Documents/GitHub/NamingAuthority/incubation/geosparql/second_attempt/triples_to_clear" | ||
|
||
g = rdflib.Graph() | ||
|
||
for root, dirs, files in os.walk(folderpath): | ||
print (root, "consumes") | ||
for name in files: | ||
print(name) | ||
print(folderpath+"/"+name) | ||
g.parse(folderpath+"/"+name) | ||
print(len(g)) | ||
|
||
g.serialize(destination="/Users/gobehobona/Documents/GitHub/NamingAuthority/incubation/geosparql/geosparqlfiles2.nt",format="nt") | ||
|
||
|
||
|
||
fin = open("/Users/gobehobona/Documents/GitHub/NamingAuthority/incubation/geosparql/geosparqlfiles2.nt",'r') | ||
lines = fin.readlines() | ||
|
||
fout = open("/Users/gobehobona/Documents/GitHub/NamingAuthority/incubation/geosparql/20231206_delete_geosparqlfiles.nt",'w') | ||
|
||
|
||
for line in lines: | ||
if "_:" in line: | ||
print("do nothing") | ||
else: | ||
fout.write(line); | ||
|
||
fout.close() | ||
|
||
''' | ||
FIRST START FUSEKI | ||
/Users/ogckm/Tools/apache-jena-fuseki-4.5.0/fuseki-server --file "/Users/ogckm/Downloads/geosparqlfiles.ttl" /geosparql | ||
THEN EXPORT ALL definition triples to all_defs_queryResults.ttl with this: | ||
CONSTRUCT {?subject ?predicate ?object} WHERE { | ||
?subject ?predicate ?object | ||
FILTER (isURI(?subject) && STRSTARTS(str(?subject), str('http://www.opengis.net/def/') ) ) | ||
} | ||
Then export distinct def URIs to distinct_def_uris.csv with this: | ||
SELECT DISTINCT ?subject { | ||
?subject ?predicate ?object | ||
FILTER (isURI(?subject) && STRSTARTS(str(?subject), str('http://www.opengis.net/def/') ) ) | ||
} | ||
''' | ||
|
11 changes: 11 additions & 0 deletions
11
incubation/geosparql/second_attempt/triples_to_add/geosparql10/citeme.bib
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,11 @@ | ||
@techreport{perry2012ogc, | ||
type = {{OGC} {Implementation} {Standard}}, | ||
title = {{OGC} {GeoSPARQL} - {A} {Geographic} {Query} {Language} for {RDF} {Data}}, | ||
url = {http://www.opengis.net/doc/IS/geosparql/1.0}, | ||
number = {OGC 11-052r4}, | ||
institution = {Open Geospatial Consortium}, | ||
author = {{Matthew Perry} and {John Herring}}, | ||
month = sep, | ||
year = {2012}, | ||
version = {1.0}, | ||
} |
Oops, something went wrong.