fils/oihBook huggingface dataset:
sys.path.insert(0, parentdir)
from lib import jbutils
with open("../../../odis-in/dataGraphs/thematics/sdg/graphs/doc.json") as dgraph:
    doc = json.load(dgraph)
context = {
    "@vocab": "https://schema.org/",
}
compacted = jsonld.compact(doc, context)
jbutils.show_graph(compacted)
citation#
Values expected to be one of these types
Text
CreativeWork
Used on these types
CreativeWork
Schema.org citation provides a way to link to another creative work.
This property can be pointed to either Text or CreativeWork.  It should also be noted that citation
can only be used on type CreativeWork.
Due to the limit to use on CreateWork only, this example is not seen in the
above examplewhich is of type Organization.
above examplewhich is of type Organization.
The actual semantics of citation is rather vague stating it is a method to
cite or reference another creative work.
import json
from rdflib.extras.external_graph_libs import rdflib_to_networkx_multidigraph
from rdflib.extras.external_graph_libs import rdflib_to_networkx_graph
from pyld import jsonld
import graphviz
import os, sys
currentdir = os.path.dirname(os.path.abspath(''))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from lib import jbutils
with open("../../../odis-in/dataGraphs/thematics/sdg/graphs/doc.json") as dgraph:
    doc = json.load(dgraph)
frame = {
  "@context": {"@vocab": "https://schema.org/"},
  "@explicit": "true",
  "@requireAll": "true",
  "@type":     "CreativeWork",
  "citation": ""
}
context = {
    "@vocab": "https://schema.org/",
}
compacted = jsonld.compact(doc, context)
framed = jsonld.frame(compacted, frame)
jd = json.dumps(framed, indent=4)
print(jd)
jbutils.show_graph(framed)
print(jd)
jbutils.show_graph(framed)
{
    "@context": {
        "@vocab": "https://schema.org/"
    },
    "@id": "https://example.org/id/XYZ",
    "@type": "CreativeWork",
    "citation": {
        "@id": "http://purl.unep.org/sdg/SDGIO_00020173",
        "@type": "CreativeWork",
        "description": "Number of countries making progress ... the oceans and their resources",
        "name": "UNSD SDG indicator code:C140c01",
        "url": "http://www.ontobee.org/ontology/SDGIO?iri=http://purl.unep.org/sdg/SDGIO_00020173"
    }
}
Refs#
SDGs
SDG targets
SDG indicators
Datasets#
About#
Datasets
See also
For OIH the focus is on generic documents which can scope reports, data and other resources.
In those cases where the resources being described are of type Dataset you may wish to review
patterns developed for GeoScience Datasets by the ESIP
Science on Schema community.
Datasets#
Documents will include maps, reports,
guidance and other creative works.  Due to this OIH will focus on a generic example
of schema.org/CreativeWork and then provide examples
for more focused creative work examples.
 1{
 2    "@context": {
 3        "@vocab": "https://schema.org/"
 4    },
 5    "@type": "Dataset",
 6    "@id": "https://registry.org/permanentUrlToThisJsonDoc",
 7    "name": "A concise but descriptive name of the dataset",
 8    "description": "An extended, free-text description of what's in the dataset, who created it, and other attributes",
 9    "url": "https://urlToTheDatasetOrLandingPage.org/",
10    "sameAs": [
11        "http://alternativeUrlToTheDatasetOrLandingPage.org"
12    ],
12    ],
13    "license": "This work is licensed under a  Creative Commons Attribution (CC-BY) 4.0 License",
14    "citation": [
15        "Citation to other work relevant to this dataset",
16        "Citation to other work relevant to this dataset",
17        "Citation to other work relevant to this dataset"
18    ],
19    "version": "2021-04-24T06:34:56.000Z",
20    "keywords": [
21        "Keyword 1",
22        "Keyword 2",
23        "Keyword 3"
24    ],
25    "measurementTechnique": "The URL to or text about the methods, technique or technology used to generate this Dataset",
26    "variableMeasured": [
27        {
28            "@type": "PropertyValue",
29            "name": "Name of a variable in the dataset",
30            "description": "Extended description of this variable"
31        },
32        {
33            "@type": "PropertyValue",
34            "name": "Name of a variable in the dataset",
35            "url": "http://ontology.org/uriToSemanticDescriptorOfThisVariable",
36            "description": "Extended description of this variable?"
37        },
38        {
37        },
38        {
39            "@type": "PropertyValue",
40            "name": "SamplingDeviceApertureSurfaceArea",
41            "url": "http://ontology.org/uriToSemanticDescriptorOfThisVariable",
42            "description": "Extended description of this variable"
43        }
44    ],
45    "includedInDataCatalog": {
46        "@id": "https://registryOfCatalogs.org/permanentUrlIdentifiyingCatalog",
47        "@type": "DataCatalog",
48        "url": "https://urlOfDataCatalog.org"
49    },
50    "temporalCoverage": "2007/2007",
51    "distribution": {
52        "@type": "DataDownload",
53        "contentUrl": "http://urlToDirectDownloadOfThisDataset.org/",
54        "encodingFormat": "text/csv"
55    },
56    "spatialCoverage": {
57        "@type": "Place",
58        "geo": {
59            "@type": "GeoShape",
60            "polygon": "142.014 10.161667,142.014 18.033833,147.997833 18.033833,147.997833 10.161667,142.014 10.161667"
61        },
62        "additionalProperty": {
61        },
62        "additionalProperty": {
63            "@type": "PropertyValue",
64            "propertyID": "http://dbpedia.org/resource/Spatial_reference_system",
65            "value": "http://www.w3.org/2003/01/geo/wgs84_pos#lat_long"
66        }
67    },
68    "provider": [
69        {
70            "@type": "Organization",
71            "legalName": "Legal Name of Organisation which generated the dataset",
72            "name": "Other Name of Organisation which generated the dataset",
73            "url": "https://organisationWebsite.org/"
74        }
75    ],
76    "subjectOf": {
77        "@type": "Event",
78        "description": "Describe the event which is the subject of this dataset. For example, a cruise ID.",
79        "name": "Concise and descriptive name of the Event",
80        "potentialAction": {
81            "@type": "Action",
82            "name": "Concise but descriptive name of action that was part of an Event. For example, the name of a CTD cast",
83            "agent": [
84                "Name or permanent ID of person or thing that performed this action",
85                "Name or permanent ID of person or thing that performed this action",
85                "Name or permanent ID of person or thing that performed this action",
86                "Name or permanent ID of person or thing that performed this action"
87            ],
88            "startTime": "2007-03-11T14:45UTC",
89            "endTime": "2007-03-11T15:42UTC",
90            "instrument": {
91                "@type": "Thing",
92                "name": "The name of the instrument used in the action. For example, the specific model of a CTD, a glider, a moored sensor",
93                "url": "http://ontology.org/uriToSemanticDescriptorOfThisInstrument",
94                "description": "Extended description of the sampling instrument"
95            }
96        }
97    }
98}
Demo area  please ignore#
This area is being used to test out a new repository structure where the data graphs,
frames and SHACL shapes are kept in a discrete location.
import warnings
with warnings.catch_warnings():
    warnings.filterwarnings("ignore",category=DeprecationWarning)
    
import json
from pyld import jsonld
import os, sys
import urllib
import contextlib
devnull = open(os.devnull, 'w')
contextlib.redirect_stderr(devnull)
currentdir = os.path.dirname(os.path.abspath(''))
contextlib.redirect_stderr(devnull)
currentdir = os.path.dirname(os.path.abspath(''))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from lib import jbutils
 
url = "https://raw.githubusercontent.com/iodepo/odis-in/master/dataGraphs/thematics/docs/graphs/map.json"
dgraph = urllib.request.urlopen(url)
doc = json.load(dgraph)
furl = "https://raw.githubusercontent.com/iodepo/odis-in/master/frames/mapFrameID.json"
fgraph = urllib.request.urlopen(furl)
frame = json.load(fgraph)
context = {
    "@vocab": "https://schema.org/",
}
compacted = jsonld.compact(doc, context)
framed = jsonld.frame(compacted, frame)
jd = json.dumps(framed, indent=4)
print(jd)
jbutils.show_graph(framed)
{
    "@context": {
        "@vocab": "https://schema.org/"
    },
    "@id": "https://example.org/id/XYZ",
    "@type": "Map",
    "identifier": {
        "@id": "https://doi.org/10.5066/F7VX0DMQ",
        "@type": "PropertyValue",
        "propertyID": "https://registry.identifiers.org/registry/doi",
        "url": "https://doi.org/10.5066/F7VX0DMQ",
        "value": "doi:10.5066/F7VX0DMQ"
    }
}
Keywords and Defined Terms#
About#
This section is looking at how the keywords could be connected
with Defined Terms that point to external vocabularies that follow
a vocabulary publishing patterns like at the W3C
Best Practice Recipes for Publishing RDF Vocabularies.
The pattern breaks down a bit when attempting to connect with things like
the Global Change Master Directory keywords.
This impedance is caused by publishing approaches for the terms that don’t align well with
the above publishing practices.  This does not mean we can not use these terms, rather that
we may find multiple ways to connect them used by the community.  This can result in some
ambiguity in linking in a community.
A person could adapt the pattern to connect things like the Global Change Observing System
or
EARTH SCIENCE > OCEANS > OCEAN CHEMISTRY.  The later of these does have a UUID (6eb3919b-85ce-4988-8b78-9d0018fd8089) but this is not a dereference-able PID.
Note
This topic of keyword linking with DefinedTerms is under review at the Science on Schema
work at ESIP.   Reference Describing a Dataset
for the latest on their recommendations.
Keywords#
The Schema.org keywords property of CreativeWork can point to three different values.
These are: DefinedTerm, Text and URL.
These are: DefinedTerm, Text and URL.
We can see the three different approaches here to defining keywords.  Here, Region X is a classic
text keyword.  The other two are defined as a DefinedTerm.
 1{
 2    "@context": {
 3        "@vocab": "https://schema.org/"
 4    },
 5    "@type": "Map",
 6    "@id": "https://example.org/id/XYZ",
 7    "name": "Name or title of the document",
 8    "description": "Description of the map to aid in searching",
 9    "url": "https://www.sample-data-repository.org/creativework/map.pdf",
10    "identifier": {
11        "@id": "https://doi.org/10.5066/F7VX0DMQ",
12        "@type": "PropertyValue",
13        "propertyID": "https://registry.identifiers.org/registry/doi",
14        "value": "doi:10.5066/F7VX0DMQ",
15        "url": "https://doi.org/10.5066/F7VX0DMQ"
16    },
17    "keywords": [
18        "Region X",
19        {
17    "keywords": [
18        "Region X",
19        {
20            "@id": "http://purl.org/dc/dcmitype/Image",
21            "@type": "DefinedTerm",
22            "inDefinedTermSet": "http://purl.org/dc/terms/DCMIType",
23            "termCode": "Image",
24            "name": "Image"
25        },
26        {
27            "@id": "https://www.wikidata.org/wiki/Q350134",
28            "@type": "URL",
29            "url": "https://www.wikidata.org/wiki/Q350134"
30        }
31    ]
32}
import json
from rdflib.extras.external_graph_libs import rdflib_to_networkx_multidigraph
from rdflib.extras.external_graph_libs import rdflib_to_networkx_graph
from pyld import jsonld
import graphviz
import os, sys
currentdir = os.path.dirname(os.path.abspath(''))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from lib import jbutils
with open("../../../odis-in/dataGraphs/thematics/terms/graphs/map.json") as dgraph:
    doc = json.load(dgraph)
frame = {
doc = json.load(dgraph)
frame = {
  "@context": {"@vocab": "https://schema.org/"},
  "@explicit": "true",
  "@requireAll": "true",
  "@type":     "Map",
  "keywords": ""
}
context = {
    "@vocab": "https://schema.org/",
}
compacted = jsonld.compact(doc, context)
framed = jsonld.frame(compacted, frame)
jbutils.show_graph(framed)
Text#
Keywords can be defined as a Text value.  This is the most common approach though
it doesn’t provide some of the benefits of the other two approaches.  For example, it doesn’t allow for terms to
be dereferenced on the net or for connects in the graph to be made for common terms by their subject IRIs.
{
{
  "@context": "https://schema.org/",
  "keywords": [
    "nitrous oxide", 
    "Central Pacific", 
    "headspace equilibration", 
    "SRI Greenhouse Gas Monitoring Gas Chromatograph", 
    "CTD profiler", 
    "Gas Chromatograph"
  ]
}
Note
Be sure to use the [] notation to define the keyword.  This defined an array of items vs a single items.  If you
use an approach like {“term1, term2, term4”} you have only created a single text string with comma separated values.  However
that is viewed as a single string in the graph.   The [] notation creates an array of strings all connected to the subject IRI
by the property keywords.
URL#
Keywords can also point to a URL.  This provides a way to link to a vocabulary entry that defines the term.  This approach
has some benefits of linking to more details but does easily provide an easy descriptive text for humans.  There is nothing
preventing putting in a text keyword followed up by another entry with a related URL.
DefinedTerm#
This is the most complex approach.  Keywords can point to a DefinedTerm as
defined in a DefinedTermSet pointed to by
the property inDefinedTermSet.  It does offer the ability to present both a human
the property inDefinedTermSet.  It does offer the ability to present both a human
focused textual name and description of the term.  This is a great way to link to a vocabulary entry that defines the term.
It also allows for a URL to be used to link to the vocabulary entry.   While this approach is the most comprehensive, it does
incur a complexity during the query process to extract and present the information.
Defined Terms#
During generation of the structured data a provide may wish to
either use or publish a set of controlled vocabulary terms or
a similar set.
Within schema.org this could be done by leveraging the “DefinedTerm”
amd “DefinedTermSet” types.
These types allow us both to define a set of terms and
use a set of terms in describing a thing.
Note that DefinedTerm is an intangible and can connect to most
types in Schema.org.  So we can use them in places such as:
CreativeWork -> keyword
CreativeWork -> learningResourceType
LearningResource -> teaches  (and many others)
LearningResource -> competencyRequired  (and many others)
PropertyValue -> valueReference
The following example is from the Schema.org DefinedTermSet
reference.
 1[
 2        {
 3                "@context": {
 4                        "@vocab": "https://schema.org/"
 5                }
 6        },
5                }
 6        },
 7        {
 8                "@type": "DefinedTermSet",
 9                "@id": "http://openjurist.org/dictionary/Ballentine",
10                "name": "Ballentine's Law Dictionary",
11                "description": "A description of Ballentine's Law Dictionary Term Set"
12        },
13        {
14                "@type": "DefinedTerm",
15                "@id": "http://openjurist.org/dictionary/Ballentine/term/calendar-year",
16                "name": "calendar year",
17                "description": "The period from January 1st to December 31st, inclusive, of any year.",
18                "inDefinedTermSet": {
19                        "@type": "DefinedTermSet",
20                        "@id": "http://openjurist.org/dictionary/Ballentine"
21                }
22        },
23        {
24                "@type": "DefinedTerm",
25                "@id": "http://openjurist.org/dictionary/Ballentine/term/schema",
26                "name": "schema",
27                "description": "A representation of a plan or theory in the form of an outline or model.",
28                "inDefinedTermSet": {
29                        "@type": "DefinedTermSet",
29                        "@type": "DefinedTermSet",
30                        "@id": "http://openjurist.org/dictionary/Ballentine"
31                }
32        }
33]
import json
from rdflib.extras.external_graph_libs import rdflib_to_networkx_multidigraph
from rdflib.extras.external_graph_libs import rdflib_to_networkx_graph
from pyld import jsonld
import graphviz
import os, sys
currentdir = os.path.dirname(os.path.abspath(''))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from lib import jbutils
with open("../../../odis-in/dataGraphs/thematics/terms/graphs/map.json") as dgraph:
    doc = json.load(dgraph)
context = {
    "@vocab": "https://schema.org/",
}
compacted = jsonld.compact(doc, context)
jbutils.show_graph(compacted)
References#
schema.org/DefinedTerm
schema.org/DefinedTermSet
Essential Ocean Variables#
This section details initial documentation of approaches for describing elements of a
schema:Dataset with a focus on approaches supporting Essential
Ocean Variables.
A rough description of these links leveraging pseudo schema.org terms follows with a detailed
and valid data graph as an example after that.
Reference image:
The image above details out some of the key points to be encoded.  These include:
Links to and description of methods
QA/QC references
Links to GOOS Specification sheets
Information on variables measured
Connections to the event measured and potential associated instruments
Spatial coverage
Temporal coverage
The valid data graph follows the reference section and details follow that.  The highlighted lines
in the data graph represented the detailed sections.
References:#
GOOS reference
Goos example spec sheet and
OBIS examples
  1{
  2    "@context": {
  3        "@vocab": "https://schema.org/"
  4    },
  5    "@type": "Dataset",
  6    "@id": "https://example.org/dataset/12345",
  7    "name": "Example Vessel Surveys Jan-Apr 2007",
7    "name": "Example Vessel Surveys Jan-Apr 2007",
  8    "description": "Original provider: HDR Environmental, Operations and Construction, Inc. Dataset credits: The U.S. Navy Marine Species Monitoring Program Abstract:Features in this feature class represent sightings from the NAVFAC MISTCS Vessel Surveys Jan-Apr 2007.",
  9    "url": "https://obis.org/dataset/dcbb8f12-c869-4d31-aa8b-23abb27898ce",
 10    "license": "This work is licensed under a  Creative Commons Attribution (CC-BY) 4.0 License",
 11    "citation": "Ampela, K. and G. Miller-Francisco. 2017. MIRC NAVFAC MISTCS Vessel Surveys Jan-Apr 2007. Data downloaded from OBIS-SEAMAP (http://seamap.env.duke.edu/dataset/1519) on yyyy-mm-dd.",
 12    "version": "2021-04-24T06:34:56.000Z",
 13    "keywords": [
 14        "Sea State",
 15        "Mariana Islands Range Complex",
 16        "Oceanography",
 17        "Marine Physics"
 18    ],
17        "Marine Physics"
 18    ],
 19    "variableMeasured": [
 20        {
 21            "@type": "PropertyValue",
 22            "name": "Sea State",
 23            "description": "Sea State is the characterization of wave and swell, typically in terms of height, wavelength, period, and directional wave energy flux ",
 24            "propertyID": [
 25                "http://purl.obolibrary.org/obo/ENVO_01001374",
 26                "https://gcmd.earthdata.nasa.gov/KeywordViewer/scheme/all/11aca777-8a01-42ce-b076-b3059c3d8cae?gtm_keyword=SEA%20STATE&gtm_scheme=Earth%20Science"
 27            ]
 28        },
 29        {
 30            "@type": "PropertyValue",
 31            "name": "Ocean Surface Stress",
 32            "description": "The 2-dimensional horizontal vector Ocean Surface Stress is the rate per unit area at which momentum is transferred from the atmosphere to the ocean.",
 33            "propertyID": "http://purl.obolibrary.org/obo/ENVO_01001844",
 34            "value": 0.2,
34            "value": 0.2,
 35            "unitCode": "http://qudt.org/vocab/unit/N-PER-M2"
 36        }
 37    ],
 38    "measurementTechnique": [
 39        "http://dx.doi.org/10.1002/exampleMethodsSeaStateDOI.ch1",
 40        "http://dx.doi.org/10.1002/exampleMethodsOceanStressDOI.ch1"
 41    ],
 42    "publishingPrinciples": [
 43        {
 44            "@type": "CreativeWork",
 45            "url": "http://www.goosocean.org/components/com_oe/oe.php?task=download&id=34494&version=1.0&lang=1&format=1",
 46            "name": "Ocean Observations Physics and Climate Panel (OOPC) Sea State GOOS EOV Specification Sheet",
 47            "description": "This is the EOV specification sheet released by GOOS for Sea State.  It was composed by the Ocean Observations Panel for Climate.  OOPC is sponsored by the Global Ocean Observing System the Global Climate Observing System and the World Climate Research Program. OOPC provides advice on scientific requirements to the Joint Commission for Oceanography and Marine Meteorology. "
 48        },
48        },
 49        {
 50            "@type": "CreativeWork",
 51            "url": "http://www.goosocean.org/components/com_oe/oe.php?task=download&id=34507&version=1.0&lang=1&format=1",
 52            "name": "Ocean Observations Physics and Climate Panel (OOPC) Ocean Surface Stress GOOS EOV Specification Sheet",
 53            "description": "This is the EOV specification sheet released by GOOS for Ocean Surface Stress.  It was composed by the Ocean Observations Panel for Climate.  OOPC is sponsored by the Global Ocean Observing System the Global Climate Observing System and the World Climate Research Program. OOPC provides advice on scientific requirements to the Joint Commission for Oceanography and Marine Meteorology. "
 54        },
 55        {
 56            "@type": "CreativeWork",
 57            "url": "http://example.org/id/doc/ID",
 58            "name": "QA/QC guidance",
58            "name": "QA/QC guidance",
 59            "description": "QA/QC  - EOV data and the methods used to generate them should have been vetted through some QA/QC methods, ideally performed by an independent third-party. These should be included in a dedicated JSON-LD block, even if it points to the same methodology linked to in the measurementTechnique block. "
 60        }
 61    ],
 62    "distribution": {
 63        "@type": "DataDownload",
 64        "contentUrl": "http://example.org/archive.do?r=zd_1519",
 65        "encodingFormat": "application/zip"
 66    },
 67    "spatialCoverage": {
 68        "@type": "Place",
 69        "geo": {
 70            "@type": "GeoShape",
 71            "polygon": "142.014 10.161667,142.014 18.033833,147.997833 18.033833,147.997833 10.161667,142.014 10.161667"
 72        },
 73        "additionalProperty": {
 74            "@type": "PropertyValue",
 75            "propertyID": "http://dbpedia.org/resource/Spatial_reference_system",
75            "propertyID": "http://dbpedia.org/resource/Spatial_reference_system",
 76            "value": "http://www.w3.org/2003/01/geo/wgs84_pos#lat_long"
 77        }
 78    },
 79    "provider": [
 80        {
 81            "@id": "https://oceanexpert.org/institution/INSTITUTE_ID",
 82            "@type": "Organization",
 83            "legalName": "Example University",
 84            "name": "Example University",
 85            "url": "https://oceanexpert.org/institution/INSTITUTE_ID"
 86        }
 87    ],
 88    "about": {
 89        "@type": "Event",
 90        "description": "describe the activity, might include name here too.",
 91        "name": "Measurement of sea state",
 92        "potentialAction": [
 93            {
 94                "@type": "Action",
 95                "name": "Measurement of sea state",
 96                "instrument": {
 97                    "@type": "Thing",
 98                    "name": "OceanWaveS WaMoS II 500 waves and surface current radar",