From e412d0e9ff484ab3985ae8912d0f4267fcb90e80 Mon Sep 17 00:00:00 2001 From: Cogan Shimizu Date: Sun, 4 Feb 2024 20:26:32 -0500 Subject: [PATCH] removed checkpoints --- .../bookend-checkpoint.ipynb | 283 ------------------ 1 file changed, 283 deletions(-) delete mode 100644 bookend/.ipynb_checkpoints/bookend-checkpoint.ipynb diff --git a/bookend/.ipynb_checkpoints/bookend-checkpoint.ipynb b/bookend/.ipynb_checkpoints/bookend-checkpoint.ipynb deleted file mode 100644 index 3de196b..0000000 --- a/bookend/.ipynb_checkpoints/bookend-checkpoint.ipynb +++ /dev/null @@ -1,283 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "e0286798", - "metadata": {}, - "source": [ - "# Welcome!\n", - "This notebook intends to be a template for an end-to-end (or, perhaps more aptly, a discovery-analysis-publish) pipeline for using Open NASA data. In this version, there is much more documentation/tutorial, as we explain _what_ is supposed to be happening and _why_ we have done these things.\n", - "\n", - "### Bookend Structure\n", - "![bookend-structure](./figures/bookend-structure.png)\n", - "\n", - "### Knowledge Graphs & Semantic Technologies\n", - "* [What is Metadata](https://github.com/KGConf/open-kg-curriculum/blob/master/curriculum/modules/What_is_Metadata/What_is_Metadata.md)\n", - "* [What is an Identifier](https://github.com/KGConf/open-kg-curriculum/blob/master/curriculum/modules/What_is_an_Identifier/What_is_an_Identifier.md)\n", - "* [What is a KG](https://github.com/KGConf/open-kg-curriculum/blob/master/curriculum/modules/What_is_a_Knowledge_Graph/What_is_a_Knowledge_Graph.md)\n", - "* [What is a Taxonomy](https://github.com/KGConf/open-kg-curriculum/blob/master/curriculum/modules/What_is_a_Taxonomy/What_is_a_Taxonomy.md)\n", - "* [What is an Ontology](https://github.com/KGConf/open-kg-curriculum/blob/master/curriculum/modules/What_is_an_Ontology/What_is_an_Ontology.md)\n", - "\n", - "#### Ontology Design Patterns\n", - "Ontology Design Patterns (ODPs) are self-contained miniature ontologies that solve domain-invariant modeling problems. Our approach uses several to create a modular \"plug and play\" KG schema (or architecture).\n", - "* Computational Environment\n", - "* [Computational Observation](https://github.com/kastle-lab/computational-observation-pattern)\n", - "* [Data Transformation](https://github.com/Data-Semantics-Laboratory/data-transformation-pattern)" - ] - }, - { - "cell_type": "markdown", - "id": "88cdf8f1", - "metadata": {}, - "source": [ - "## Bookend Software\n", - "* [rdflib](https://rdflib.readthedocs.io/en/stable/)\n", - "* [sparqlwrapper](https://sparqlwrapper.readthedocs.io/en/latest/)" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "7f7e9211", - "metadata": {}, - "outputs": [], - "source": [ - "# rdflib is the general purpose python library for modifying a kg in memory and outputting it to a file\n", - "import rdflib\n", - "## Just some convenient classes to pull out\n", - "from rdflib import URIRef, Graph, Namespace, Literal\n", - "## namespaces are below. These are where identifiers \"live\", so to speak.\n", - "from rdflib import OWL, RDF, RDFS, XSD, TIME\n", - "\n", - "# sparqlwrapper is used to query a triplestore\n", - "import SPARQLWrapper" - ] - }, - { - "cell_type": "markdown", - "id": "2155930e", - "metadata": {}, - "source": [ - "## Prefixes" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "649594ff", - "metadata": {}, - "outputs": [], - "source": [ - "name_space = \"https://polyneme.xyz/\"\n", - "pfs = {\n", - "\"polyr\": Namespace(f\"{name_space}lod/resource/\"),\n", - "\"poly-ont\": Namespace(f\"{name_space}lod/ontology/\"),\n", - "\"geo\": Namespace(\"http://www.opengis.net/ont/geosparql#\"),\n", - "\"geof\": Namespace(\"http://www.opengis.net/def/function/geosparql/\"),\n", - "\"sf\": Namespace(\"http://www.opengis.net/ont/sf#\"),\n", - "\"wd\": Namespace(\"http://www.wikidata.org/entity/\"),\n", - "\"wdt\": Namespace(\"http://www.wikidata.org/prop/direct/\"),\n", - "\"dbo\": Namespace(\"http://dbpedia.org/ontology/\"),\n", - "\"time\": Namespace(\"http://www.w3.org/2006/time#\"),\n", - "\"ssn\": Namespace(\"http://www.w3.org/ns/ssn/\"),\n", - "\"sosa\": Namespace(\"http://www.w3.org/ns/sosa/\"),\n", - "\"cdt\": Namespace(\"http://w3id.org/lindt/custom_datatypes#\"),\n", - "\"ex\": Namespace(\"https://example.com/\"),\n", - "\"rdf\": RDF,\n", - "\"rdfs\": RDFS,\n", - "\"xsd\": XSD,\n", - "\"owl\": OWL,\n", - "\"time\": TIME\n", - "}" - ] - }, - { - "cell_type": "markdown", - "id": "91300f3a", - "metadata": {}, - "source": [ - "## Storing Metadata\n", - "It should perhaps come as no surprise the rest of the notebook, but we will store the metadata generated in this notebook in a knowledge graph. For now, it will stay in memory as `Graph` from `rdflib`. When we publish the dataset generated in this notebook, we will upload the dataset into a graph database. " - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "81278fdc", - "metadata": {}, - "outputs": [], - "source": [ - "def init_kg(prefixes=pfs):\n", - " kg = Graph()\n", - " for prefix in pfs:\n", - " kg.bind(prefix, pfs[prefix])\n", - " return kg\n", - "# rdf:type shortcut\n", - "a = pfs[\"rdf\"][\"type\"]\n", - "\n", - "# Initialize an empty graph\n", - "graph = init_kg()" - ] - }, - { - "cell_type": "markdown", - "id": "aad80af2", - "metadata": {}, - "source": [ - "## Accessing Your Local Graph Database\n", - "For this notebook, we assume you are running a `developer` (i.e., non-production) Apache Jena Fuseki triplestore as your graph database. This will be useful in several different cells." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b8c5367b", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "id": "39e00634", - "metadata": {}, - "source": [ - "## Capturing the Current Computational Environment\n", - "![computational environment](./figures/computational-environment-pattern.png)\n", - "The purpose of this is to capture the environment in which you transform data (i.e., create something new from something old). This is useful for replicability." - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "8d2a05b6", - "metadata": {}, - "outputs": [], - "source": [ - "# Code to populate this pattern for this notebook\n", - "\n", - "## Mint a URI for this computational environment\n", - "### There are many ways to create an identifier\n", - "### We have chosen a way that encodes some information for identifiability, without searching for the label.\n", - "comp_env_name = \"polyneme.donny.home\"\n", - "###\n", - "\n", - "\n", - "\n", - "\n", - "## If you have done this before (i.e., this is not your first time running this notebook) AND your \n", - "## computational environment hasn't changed.\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "id": "f7b7cc5d", - "metadata": {}, - "source": [ - "## Computational Observations\n", - "![simulation activity](./figures/computational-observation-pattern.jpg)" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "356f6c14", - "metadata": {}, - "outputs": [], - "source": [ - "# Code to populate this pattern for this notebook\n", - "pass" - ] - }, - { - "cell_type": "markdown", - "id": "b0241607", - "metadata": {}, - "source": [ - "## Dataset Discovery" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "77a30b13", - "metadata": {}, - "outputs": [], - "source": [ - "# Code to do data set discovery\n", - "## PySat?\n", - "## HDPE.io\n", - "## CDAWeb\n", - "pass" - ] - }, - { - "cell_type": "markdown", - "id": "f2c7aece", - "metadata": {}, - "source": [ - "## This is where your code goes!" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6bb4c8ea", - "metadata": {}, - "outputs": [], - "source": [ - "pass" - ] - }, - { - "cell_type": "markdown", - "id": "14ef1513", - "metadata": {}, - "source": [ - "## Dataset Publishing (Internal)\n", - "Now it is time to publish your work.\n", - "\n", - "### Data Transformation Pattern\n", - "![data transformation pattern](./figures/data-transformation-pattern.jpg)" - ] - }, - { - "cell_type": "markdown", - "id": "47a7f801", - "metadata": {}, - "source": [] - }, - { - "cell_type": "markdown", - "id": "ff84d8ca", - "metadata": {}, - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.10.6" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}