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

JSON Context issue. Identify bad contexts #129

Closed
valentinedwv opened this issue Dec 19, 2022 · 5 comments
Closed

JSON Context issue. Identify bad contexts #129

valentinedwv opened this issue Dec 19, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@valentinedwv
Copy link
Member

valentinedwv commented Dec 19, 2022

Bad Context (string plus object) is getting mangled somewhere.
https://validator.schema.org/#url=https%3A%2F%2Fearthref.org%2FMagIC%2F11131

source:

{"@context": [
    "https://schema.org/",
    {
      "gsqtime": "https://vocabs.gsq.digital/object?uri=http://linked.data.gov.au/def/trs",
      "time": "http://www.w3.org/2006/time#",
      "xsd": "https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html"
    }
  ],
  "@type": "Dataset",
  "identifier": "https://dx.doi.org/10.7288/V4/MAGIC/11131",
  "sameAs": [
    "https://earthref.org/MagIC/doi/10.1073/PNAS.1616976114"
  ],
}

getting uploaded as:

{
  "@context": {"@vocab":"https:///"},
  "@type": "Dataset",
  "identifier": "https://dx.doi.org/10.7288/V4/MAGIC/12004",
  "sameAs": [
    "https://earthref.org/MagIC/doi/10.1016/0012-821X(78)90077-8"
  ],
}

Magic JSONLD, and the RDF seems a bit terse.
sitemap

Wait looking at this it is the same issue we have with wifire. bad context.

"@context": {"@vocab":"https:///"},

{
  "@context": {"@vocab":"https:///"},
  "@type": "Dataset",
  "identifier": "https://dx.doi.org/10.7288/V4/MAGIC/12661",
  "sameAs": "https://earthref.org/MagIC/12661",
  "isAccessibleForFree": true,
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "provider": {
    "@id": "https://earthref.org/MagIC",
    "@type": "Organization",
    "identifier": "https://www.re3data.org/repository/r3d100011910",
    "legalName": "Magnetics Information Consortium (MagIC) Data Repository",
    "name": "MagIC",
    "url": "https://earthref.org/MagIC"
  },
  "publisher": {
    "@id": "https//earthref.org/MagIC"
  },
  "sdPublisher": "EarthRef.org",
  "sdLicense": "https://creativecommons.org/licenses/by/4.0/",
  "sdDatePublished": "2022-10-14T21:01:51.447Z",
  "distribution": {
    "@type": "DataDownload",
    "contentUrl": "https://earthref.org/MagIC/download/12661/magic_contribution_12661.txt",
    "encodingFormat": [
      "text/plain; application=earthref-tsv",
      "EarthRef-tsv-Multipart"
    ]
  },
  "version": 2,
  "contributor": "MagIC Database Team",
  "dateModified": "2006-12-18T11:10:39.000Z",
  "citation": "<b>Facer, R.A. (1971).</b> Intrusion and magnetization of the Giles Complex, Central Australia.<i> Geophysical Journal of the Royal Astronomical Society 22: 517-520.</i>",
  "name": "<b>Facer, R.A. (1971).</b> Intrusion and magnetization of the Giles Complex, Central Australia.<i> Geophysical Journal of the Royal Astronomical Society 22: 517-520.</i> (Dataset)",
  "description": "Paleomagnetic, rock magnetic, or geomagnetic data found in the MagIC data repository from a paper titled: <b>Facer, R.A. (1971).</b> Intrusion and magnetization of the Giles Complex, Central Australia.<i> Geophysical Journal of the Royal Astronomical Society 22: 517-520.</i>",
  "datePublished": "2006-12-18T11:10:39.000Z",
  "temporalCoverage": {
    "@type": "time:ProperInterval",
    "time:hasBeginning": {
      "time:hasTRS": {
        "@id": "gsqtime:BeforePresent"
      },
      "time:numericPosition": {
        "@value": 900000000,
        "@type": "xsd:decimal"
      },
      "gstime:geologicTimeUnitAbbreviation": {
        "@type": "xsd:string",
        "value": "BP"
      }
    },
    "time:hasEnd": {
      "time:hasTRS": {
        "@id": "gsqtime:BeforePresent"
      },
      "time:numericPosition": {
        "@value": 1180000000,
        "@type": "xsd:decimal"
      },
      "gstime:geologicTimeUnitAbbreviation": {
        "@type": "xsd:string",
        "value": "BP"
      }
    }
  },
  "variableMeasured": [
    {
      "@type": "PropertyValue",
      "name": "Direction K",
      "description": "Specimen direction in coordinates specified by tilt correction, Fisher's dispersion parameter Kappa",
      "minValue": 1.7,
      "maxValue": 3.2,
      "unitText": "Dimensionless"
    },
    {
      "@type": "PropertyValue",
      "name": "Pole Longitude",
      "description": "Pole longitude, average of site VGP longitudes, north pole",
      "minValue": 307.1,
      "maxValue": 307.1,
      "unitText": "Degrees"
    },
    {
      "@type": "PropertyValue",
      "name": "Inclination",
      "description": "Directions in specimen coordinates, Inclination",
      "minValue": -86,
      "maxValue": -35,
      "unitText": "Degrees"
    },
    {
      "@type": "PropertyValue",
      "name": "Direction Alpha 95%",
      "description": "Specimen direction in coordinates specified by tilt correction, Fisher circle",
      "minValue": 12,
      "maxValue": 21,
      "unitText": "Degrees"
    },
    {
      "@type": "PropertyValue",
      "name": "Pole DM",
      "description": "Pole meridian uncertainty",
      "minValue": 24,
      "maxValue": 24,
      "unitText": "Degrees"
    },
    {
      "@type": "PropertyValue",
      "name": "Pole DP",
      "description": "Pole parallel latitude uncertainty",
      "minValue": 24,
      "maxValue": 24,
      "unitText": "Degrees"
    },
    {
      "@type": "PropertyValue",
      "name": "Percentage Reversed Sites",
      "description": "Percentage of sites that are reversed",
      "minValue": 200,
      "maxValue": 200,
      "unitText": "%"
    },
    {
      "@type": "PropertyValue",
      "name": "Direction N Samples",
      "description": "Number of samples included in directional calculations.",
      "minValue": 39,
      "maxValue": 39
    },
    {
      "@type": "PropertyValue",
      "name": "Pole Latitude",
      "description": "Pole latitude, average of site VGP latitudes, north pole",
      "minValue": 18.4,
      "maxValue": 18.4,
      "unitText": "Degrees"
    },
    {
      "@type": "PropertyValue",
      "name": "Direction N Sites",
      "description": "Number of sites included in directional calculations",
      "minValue": 4,
      "maxValue": 39
    },
    {
      "@type": "PropertyValue",
      "name": "Direction Tilt K Ratio",
      "description": "Comparison of Fisher dispersion K after and before tilt correction",
      "minValue": 0.52,
      "maxValue": 0.52,
      "unitText": "Dimensionless"
    },
    {
      "@type": "PropertyValue",
      "name": "Declination",
      "description": "Directions in specimen coordinates, Declination",
      "minValue": 169,
      "maxValue": 322,
      "unitText": "Degrees"
    },
    {
      "@type": "PropertyValue",
      "name": "Direction Tilt Correction",
      "description": "Percentage tilt correction applied to the data",
      "minValue": 0,
      "maxValue": 100,
      "unitText": "%"
    }
  ]
}
_:bcd584c9o951m1npdu3dg <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <xsd:string> .
_:bcd584c9o951m1npdu3e0 <gstime:geologicTimeUnitAbbreviation> _:bcd584c9o951m1npdu3eg .
_:bcd584c9o951m1npdu3e0 <time:hasTRS> <gsqtime:BeforePresent> .
_:bcd584c9o951m1npdu3e0 <time:numericPosition> "900000000"^^<xsd:decimal> .
_:bcd584c9o951m1npdu3f0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <time:ProperInterval> .
_:bcd584c9o951m1npdu3f0 <time:hasBeginning> _:bcd584c9o951m1npdu3e0 .
_:bcd584c9o951m1npdu3f0 <time:hasEnd> _:bcd584c9o951m1npdu3fg .
_:bcd584c9o951m1npdu3eg <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <xsd:string> .
_:bcd584c9o951m1npdu3fg <gstime:geologicTimeUnitAbbreviation> _:bcd584c9o951m1npdu3dg .
_:bcd584c9o951m1npdu3fg <time:hasTRS> <gsqtime:BeforePresent> .
_:bcd584c9o951m1npdu3fg <time:numericPosition> "1180000000"^^<xsd:decimal> .

Archive.zip

@valentinedwv valentinedwv added the wontfix This will not be worked on label Dec 19, 2022
@valentinedwv
Copy link
Member Author

Wait... this is a fragment from one original files:
https://validator.schema.org/#url=https%3A%2F%2Fearthref.org%2FMagIC%2F11131

"@context": [
    "https://schema.org/",
    {
      "gsqtime": "https://vocabs.gsq.digital/object?uri=http://linked.data.gov.au/def/trs",
      "time": "http://www.w3.org/2006/time#",
      "xsd": "https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html"
    }
  ],
  "@type": "Dataset",
  "identifier": "https://dx.doi.org/10.7288/V4/MAGIC/11131",
  "sameAs": [
    "https://earthref.org/MagIC/doi/10.1073/PNAS.1616976114"
  ],

@valentinedwv valentinedwv added bug Something isn't working and removed wontfix This will not be worked on labels Dec 20, 2022
@valentinedwv valentinedwv changed the title Conversion to RDF may be wrong. JSON Context issue. Identify bad contexts Dec 20, 2022
valentinedwv added a commit that referenced this issue Dec 20, 2022
@valentinedwv
Copy link
Member Author

Failing tests on fix_129_context branch

@valentinedwv
Copy link
Member Author

valentinedwv commented Dec 20, 2022

WIfire, too.

https://validator.schema.org/#url=https%3A%2F%2Fwifire-data.sdsc.edu%2Fdataset%2Factive-fire-event-polygons

goes to:

          {
    "@context": {"@vocab":"https:///"},
    "@graph": [
]
}

@valentinedwv
Copy link
Member Author

similar to spec cases 20 and 22
https://www.w3.org/TR/json-ld11/#example-20-describing-disconnected-nodes-with-graph
https://www.w3.org/TR/json-ld11/#example-22-combining-external-and-local-contexts

But those are 'local' schemas.
This is just a 'string' case combined with a object context. Think this is a good case for standardize. While I will also attempt to @vocab it.

@valentinedwv
Copy link
Member Author

branch fix_129 handles this.

valentinedwv added a commit that referenced this issue Mar 3, 2023
valentinedwv added a commit that referenced this issue Mar 3, 2023
valentinedwv added a commit that referenced this issue Mar 6, 2023
* run configurations

* adding a uuid command to get uuid for a file sent to stdin.
updated cobra and viper package versions

* Example JSON Paths and arrays of paths


* glcon tool id --idtype indentifiersha --jsonld some file

* test for #129.

* Implemented changes to prevent context mangling

*

* Get things working and DRY code up a bit

* Extract out a constant and a json processing function

* Add test for json finding method

* Test for the api config helper

* Try to make this work for DataStream as well

* Identifiers fix for @graph


* fix wrap in quotes 'script[type="application/ld+json"]'

* add an ideal example resource

* IdentiferPath is a comma separated set of strings, or one string.

* If you are trying not to recorder an array... and copy it, don't use the original later
Clean up LdProc Normalize Tests. Empty triples will be empty triples

* #150 #108
initialize gleaner and nabu configs idependently.

* #145

* added test for a couple of problem children.

* methods to allow dumping data before upload

and glcon tools
jsonld: jsonld > corrected jsonld
rdf: jsonld > rdf

* add a couple resources for cli testing

* Headless rework to make more testable

* Fix Minio connection check error, like was done on nabu

* Implement headlessWait in the headless Javascript.
Fixes #152

* Implement headlessWait in the headless Javascript.
Fixes #152
add a test that is expected to fail, with 1 JSONld returned.

* #155 enable --prefix flag for nabu

* Using c.Page.LoadEventFired to wait for content.
Works. leaving in the headlessWait incase another issue that requires its.

* linux reading of config not working. Updating modules

* Use the config class to read the gleanerConfig.

* Use the config class to read the gleanerConfig.

* Cleaned up tests. Files now used. (#161)

Added ability to just generate a sha of the json.
Was option, but not coded.

* Fix 124 identifiers tests (#162)

* Cleaned up tests. Files now used.
Added ability to just generate a sha of the json.
Was option, but not coded.

* put in approvals into jsonutils

* use log.info not println so this does not show up in console output.

* test for #129.

* Implemented changes to prevent context mangling

* Example JSON Paths and arrays of paths

* clean up some logging CLI.

* glcon tool id --idtype indentifiersha --jsonld some file

* If it's an array, we standardized.
Tests to be sure arrays are not mangled by string
and that strings are not mangled by array.


* IdentiferPath is a comma separated set of strings, or one string.

* methods to allow dumping data before upload
 glcon tools
jsonld: jsonld > corrected jsonld
rdf: jsonld > rdf

Added ability to just generate a sha of the json.
Was option, but not coded.

* Fix 124 identifiers tests (#162)

* put in approvals into jsonutils

* add approval test .approved

* Sort the jsonpath results because UUID generation depends on order of results.


* One more fix for tool id. If no config is passed, just use a generic one.
We need is the contexts, for the triples if it falls through to a normalizedsha
makefile. copy binaries up to that assets are in correct location relative to binaries


---------

Co-authored-by: melinda <melindaminch@oceannetworks.ca>
Co-authored-by: Douglas Fils <drfils@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants