Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate crosswalk for JSON-LD #15

Open
webb-ben opened this issue Sep 11, 2023 · 0 comments
Open

Investigate crosswalk for JSON-LD #15

webb-ben opened this issue Sep 11, 2023 · 0 comments

Comments

@webb-ben
Copy link
Member

webb-ben commented Sep 11, 2023

The java implementation of the NLDI provides rich text results for individually identifier crawled features:

i.e. for wqp/WIDNR_WQX-133553/json

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-89.541614, 43.125092]
      },
      "properties": {
        "identifier": "WIDNR_WQX-133553",
        "navigation": "https://labs.waterdata.usgs.gov/api/nldi/linked-data/wqp/WIDNR_WQX-133553/navigation",
        "name": "Pheasant Branch at Schneider Rd",
        "source": "WQP",
        "sourceName": "Water Quality Portal",
        "comid": "13293676",
        "type": "varies",
        "uri": "https://www.waterqualitydata.us/provider/STORET/WIDNR_WQX/WIDNR_WQX-133553/",
        "mainstem": "https://geoconnex.us/ref/mainstems/575519"
      }
    }
  ]
}

there is wqp/WIDNR_WQX-133553/json+ld

{
  "@context": [
    {
      "schema": "https://schema.org/",
      "geo": "schema:geo",
      "hyf": "https://www.opengis.net/def/schema/hy_features/hyf/",
      "gsp": "http://www.opengis.net/ont/geosparql#",
      "name": "schema:name",
      "comid": {
        "@id": "schema:geoWithin",
        "@type": "@id"
      },
      "hyf:linearElement": {
        "@type": "@id"
      }
    }
  ],
  "@id": "https://www.waterqualitydata.us/provider/STORET/WIDNR_WQX/WIDNR_WQX-133553/",
  "@type": "https://www.opengis.net/def/schema/hy_features/hyf/HY_HydroLocation",
  "schema:subjectOf": {
    "@type": "schema:CreativeWork",
    "schema:identifier": "WQP",
    "schema:name": "Water Quality Portal"
  },
  "name": "Pheasant Branch at Schneider Rd",
  "comid": "https://geoconnex.us/nhdplusv2/comid/13293676",
  "hyf:referencedPosition": [
    {
      "hyf:HY_IndirectPosition": {
        "hyf:linearElement": "https://geoconnex.us/ref/mainstems/575519"
      }
    }
  ],
  "geo": {
    "@type": "schema:GeoCoordinates",
    "schema:longitude": -89.541614,
    "schema:latitude": 43.125092
  },
  "gsp:hasGeometry": {
    "@type": "http://www.opengis.net/ont/sf#Point",
    "gsp:asWKT": {
      "@value": "POINT(-89.541614 43.125092)",
      "@type": "http://www.opengis.net/ont/geosparql#wktLiteral"
    }
  }
}

with the python implementation, these pages can alternatively be represented via pygeoapi (and thus an HTML, JSON, and JSON-LD representation):
https://nldi.internetofwater.app/api/nldi/pygeoapi/collections/nldi/features/items/WIDNR_WQX-133553
image
with this JSON-LD out of the box (note this could be templated easily through pygeoapi)

{
  "@context": [
    {
      "schema": "https://schema.org/",
      "type": "@type",
      "gsp": "http://www.opengis.net/ont/geosparql#"
    }
  ],
  "type": "schema:Place",
  "id": "WIDNR_WQX-133553",
  "prev": "WIDNR_WQX-133552",
  "next": "WIDNR_WQX-134002",
  "uri": "http://www.waterqualitydata.us/provider/STORET/WIDNR_WQX/WIDNR_WQX-133553/",
  "crawler_source_id": 1,
  "comid": 13293676,
  "measure": null,
  "name": "Pheasant Branch at Schneider Rd",
  "reachcode": null,
  "shape": null,
  "geometry": {
    "type": "Point",
    "coordinates": [-89.541614, 43.125092]
  },
  "gsp:hasGeometry": {
    "@type": "http://www.opengis.net/ont/sf#Point",
    "gsp:asWKT": {
      "@type": "http://www.opengis.net/ont/geosparql#wktLiteral",
      "@value": "POINT (-89.541614 43.125092)"
    }
  },
  "schema:geo": {
    "@type": "schema:GeoCoordinates",
    "schema:longitude": -89.541614,
    "schema:latitude": 43.125092
  },
  "@id": "https://nldi.internetofwater.app/api/nldi/pygeoapi/collections/nldi/features/items/WIDNR_WQX-133553",
  "links": [
    {
      "type": "application/json",
      "rel": "root",
      "title": "The landing page of this server as JSON",
      "href": "https://nldi.internetofwater.app/api/nldi/pygeoapi?f=json"
    },
    {
      "type": "text/html",
      "rel": "root",
      "title": "The landing page of this server as HTML",
      "href": "https://nldi.internetofwater.app/api/nldi/pygeoapi?f=html"
    },
    {
      "rel": "alternate",
      "type": "application/geo+json",
      "title": "This document as GeoJSON",
      "href": "https://nldi.internetofwater.app/api/nldi/pygeoapi/collections/nldi/features/items/WIDNR_WQX-133553?f=json"
    },
    {
      "rel": "self",
      "type": "application/ld+json",
      "title": "This document as RDF (JSON-LD)",
      "href": "https://nldi.internetofwater.app/api/nldi/pygeoapi/collections/nldi/features/items/WIDNR_WQX-133553?f=jsonld"
    },
    {
      "rel": "alternate",
      "type": "text/html",
      "title": "This document as HTML",
      "href": "https://nldi.internetofwater.app/api/nldi/pygeoapi/collections/nldi/features/items/WIDNR_WQX-133553?f=html"
    },
    {
      "rel": "collection",
      "type": "application/json",
      "title": "Features",
      "href": "https://nldi.internetofwater.app/api/nldi/pygeoapi/collections/nldi/features"
    },
    {
      "rel": "prev",
      "type": "application/ld+json",
      "href": "https://nldi.internetofwater.app/api/nldi/pygeoapi/collections/nldi/features/items/WIDNR_WQX-133552?f=jsonld"
    },
    {
      "rel": "next",
      "type": "application/ld+json",
      "href": "https://nldi.internetofwater.app/api/nldi/pygeoapi/collections/nldi/features/items/WIDNR_WQX-134002?f=jsonld"
    }
  ]
}

cc: @dblodgett-usgs @ksonda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant