Skip to content

Commit

Permalink
Merge pull request #31 from Kurrawong/master
Browse files Browse the repository at this point in the history
Convert Excel and update
  • Loading branch information
vedgell authored Mar 24, 2024
2 parents e611c45 + 6b2e6b5 commit 6f96f5c
Show file tree
Hide file tree
Showing 69 changed files with 15,276 additions and 11,549 deletions.
Binary file not shown.
Binary file added excel/0.4.3/Borehole_Material_Boreholes.xlsx
Binary file not shown.
Binary file added excel/0.4.3/Borehole_Purpose_Boreholes.xlsx
Binary file not shown.
Binary file added excel/0.4.3/Borehole_status_Boreholes.xlsx
Binary file not shown.
Binary file added excel/0.4.3/Confidence_Level_Boreholes.xlsx
Binary file not shown.
Binary file added excel/0.4.3/Date_Qualifiers_Boreholes.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added excel/0.4.3/Drilling_Methods_Boreholes.xlsx
Binary file not shown.
Binary file not shown.
Binary file added excel/0.4.3/Legislation_Boreholes.xlsx
Binary file not shown.
Binary file added excel/0.4.3/LocationMethodBoreholes.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added excel/0.4.3/QA_status_code_Boreholes.xlsx
Binary file not shown.
Binary file added excel/0.4.3/Sample_Type_Boreholes.xlsx
Binary file not shown.
Binary file added excel/0.4.3/Sampling_Methods_boreholes.xlsx
Binary file not shown.
Binary file added excel/0.4.3/Source_Rock_Quality_Boreholes.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions scripts/_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyshacl
httpx
23 changes: 23 additions & 0 deletions scripts/add_org_rdf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import glob
from rdflib import Graph
from rdflib.namespace import SDO

for f in glob.glob("/Users/nick/Work/ga/ga-vocabs/vocabularies/*.ttl"):
g = Graph().parse(f)
addition = """
PREFIX sdo: <https://schema.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
<https://linked.data.gov.au/org/ga>
a sdo:Organization ;
sdo:description "Geoscience Australia is Australia's pre-eminent public sector geoscience organisation. It is the nation's trusted advisor on the geology and geography of Australia. It applies science and technology to describe and understand the Earth for the benefit of Australia."@en ;
sdo:name "Geoscience Australia" ;
sdo:url "https://www.ga.gov.au"^^xsd:anyURI ;
.
"""
g += Graph().parse(data=addition, format="turtle")
g.bind("sdo", SDO)
g.serialize(destination=f, format="longturtle")

print(f"Done {f}")
15 changes: 15 additions & 0 deletions scripts/process_043_excel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# /Users/nick/Library/Caches/pypoetry/virtualenvs/vocexcel-XgwzAsEM-py3.11/bin/python /Users/nick/Work/rdflib/VocExcel/vocexcel/__main__.py Borehole_Construction_Type_Boreholes.xlsx > Borehole_Construction_Type_Boreholes.ttl
# echo "Borehole_Construction_Type_Boreholes"


FILES=/Users/nick/Work/ga/ga-vocabs/excel/0.4.3/*.xlsx

for f in $FILES
do
echo "Processing $f"
fttl=${f%.*}.ttl

/Users/nick/Library/Caches/pypoetry/virtualenvs/vocexcel-XgwzAsEM-py3.11/bin/python /Users/nick/Work/rdflib/VocExcel/vocexcel/__main__.py $f > $fttl
echo "Completed $fttl"
done
21 changes: 15 additions & 6 deletions scripts/validate_vocabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
from pyshacl import validate
import httpx

WARNINGS_INVALID = False # Allows warnings to flag as invalid when true
WARNINGS_INVALID = False # Allows warnings to flag as invalid when true
SHOW_WARNINGS = True


def main():
# get the validator
r = httpx.get("https://w3id.org/profile/vocpub/validator/4.6", follow_redirects=True)
r = httpx.get("https://w3id.org/profile/vocpub/validator/4.7", follow_redirects=True)
assert r.status_code == 200
with open("vocpub-4.7.ttl", "w") as f:
f.write(r.text)

# for all vocabs...
warning_vocabs = {} # format {vocab_filename: warning_msg}
invalid_vocabs = {} # format {vocab_filename: error_msg}
warning_vocabs = {} # format {vocab_filename: warning_msg}
invalid_vocabs = {} # format {vocab_filename: error_msg}
vocabs_dir = Path(__file__).parent.parent / "vocabularies"
for f in vocabs_dir.glob("**/*"):
# ...validate each file
Expand Down Expand Up @@ -45,9 +48,15 @@ def main():
print(error)
print("-----")

ret = True
if WARNINGS_INVALID:
assert len(warning_vocabs.keys()) == 0, "Warning vocabs: {}".format(", ".join([str(x) for x in warning_vocabs.keys()]))
assert len(invalid_vocabs.keys()) == 0, "Invalid vocabs: {}".format(", ".join([str(x) for x in invalid_vocabs.keys()]))
if len(warning_vocabs.keys()) > 0:
print("Warning vocabs: {}".format(", ".join([str(x) for x in warning_vocabs.keys()])))
ret = False
if len(invalid_vocabs.keys()) > 0:
print("Invalid vocabs: {}".format(", ".join([str(x) for x in invalid_vocabs.keys()])))
ret = False
assert ret


if __name__ == "__main__":
Expand Down
Loading

0 comments on commit 6f96f5c

Please sign in to comment.