json-ld / json-ld.org

JSON for Linked Data's documentation and playground site
https://json-ld.org/
Other
853 stars 152 forks source link

Inconsistency in json output #758

Closed garpinc closed 2 years ago

garpinc commented 2 years ago

Input RDF:

<http://cambridgesemantics.com/Graphmart/0c09fdcc39d047ddbcf1961bf425f423> {
    <http://cambridgesemantics.com/Graphmart/0c09fdcc39d047ddbcf1961bf425f423> <http://cambridgesemantics.com/ontologies/Graphmarts#dataAclsInheritFrom> <http://cambridgesemantics.com/Graphmart/0c09fdcc39d047ddbcf1961bf425f423> ;
        <http://cambridgesemantics.com/ontologies/Graphmarts#defaultDataAclsInheritFromGraphmart> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> ;
        <http://cambridgesemantics.com/ontologies/Graphmarts#disableLoadCounts> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> ;
        <http://cambridgesemantics.com/ontologies/Graphmarts#generateStatisticsAfterEachLayer> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> ;
        <http://cambridgesemantics.com/ontologies/Graphmarts#ignoreErrors> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> ;
        <http://cambridgesemantics.com/ontologies/Graphmarts#lastValidationTime> "2021-07-23T09:18:39.410-04:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
        <http://cambridgesemantics.com/ontologies/Graphmarts#layer> <http://cambridgesemantics.com/OrderedItem/8cb61e96c362411b94393b1f094ddefe> ;
        <http://cambridgesemantics.com/ontologies/Graphmarts#loadPriority> "100"^^<http://www.w3.org/2001/XMLSchema#int> ;
        <http://cambridgesemantics.com/ontologies/Graphmarts#manualRefresh> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> ;
        <http://openanzo.org/ontologies/2008/07/Anzo#defaultNamedGraph> <http://cambridgesemantics.com/Graphmart/0c09fdcc39d047ddbcf1961bf425f423> , <http://cambridgesemantics.com/Layer/a322d93542f1453e85c1775b77e84fba> , <http://cambridgesemantics.com/LoadDataStep/9f2a0cfbfa954fd09aaf898ef897dde2> ;
        <http://purl.org/dc/elements/1.1/title> "CSV1 to Server Anzo Data Store - Old Run Graphmart" ;
        <http://purl.org/dc/terms/created> "2021-07-13T10:55:47.000-04:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
        <http://purl.org/dc/terms/creator> <http://openanzo.org/system/internal/sysadmin> ;
        <http://purl.org/dc/terms/modified> "2021-07-23T09:18:39.410-04:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
        <http://purl.org/dc/terms/modifier> <http://openanzo.org/system/internal/sysadmin> ;
        a <http://cambridgesemantics.com/ontologies/Graphmarts#Graphmart> , <http://openanzo.org/ontologies/2008/07/Anzo#Dataset> .
    <http://cambridgesemantics.com/LoadDataStep/9f2a0cfbfa954fd09aaf898ef897dde2> a <http://openanzo.org/ontologies/2008/07/Anzo#NamedGraph> .
    <http://cambridgesemantics.com/OrderedItem/8cb61e96c362411b94393b1f094ddefe> <http://openanzo.org/ontologies/2008/07/Anzo#index> "0"^^<http://www.w3.org/2001/XMLSchema#int> ;
        <http://openanzo.org/ontologies/2008/07/Anzo#orderedValue> <http://cambridgesemantics.com/Layer/a322d93542f1453e85c1775b77e84fba> ;
        a <http://openanzo.org/ontologies/2008/07/Anzo#IndexedItem> , <http://openanzo.org/ontologies/2008/07/Anzo#OrderedValue> .
    <http://openanzo.org/system/internal/sysadmin> a <http://www.w3.org/2002/07/owl#Thing> .
}
<http://cambridgesemantics.com/Layer/a322d93542f1453e85c1775b77e84fba> {
    <http://cambridgesemantics.com/Layer/a322d93542f1453e85c1775b77e84fba> a <http://cambridgesemantics.com/ontologies/Graphmarts#Layer> .
}

post json-ld:

{
  "@context" : [ "http://www.w3.org/2002/07/owl/Thing", "http://openanzo.org/ontologies/2008/07/Anzo/NamedGraph", "http://cambridgesemantics.com/ontologies/Graphmarts/Graphmart", "http://openanzo.org/ontologies/2008/07/Anzo/Dataset", "http://openanzo.org/ontologies/2008/07/Anzo/OrderedValue", "http://openanzo.org/ontologies/2008/07/Anzo/IndexedItem", "http://cambridgesemantics.com/ontologies/Graphmarts/Layer" ],
  "uri" : "http://cambridgesemantics.com/Graphmart/0c09fdcc39d047ddbcf1961bf425f423",
  "type" : "http://cambridgesemantics.com/ontologies/Graphmarts#Graphmart",
  "dataAclsInheritFrom" : {
    "uri" : "http://cambridgesemantics.com/Graphmart/0c09fdcc39d047ddbcf1961bf425f423"
  },
  "defaultDataAclsInheritFromGraphmart" : true,
  "disableLoadCounts" : false,
  "generateStatisticsAfterEachLayer" : false,
  "ignoreErrors" : true,
  "lastValidationTime" : {
    "type" : "http://www.w3.org/2001/XMLSchema#dateTime",
    "@value" : "2021-07-23T09:18:39.410-04:00"
  },
  "layer" : {
    "uri" : "http://cambridgesemantics.com/OrderedItem/8cb61e96c362411b94393b1f094ddefe",
    "type" : "http://openanzo.org/ontologies/2008/07/Anzo#OrderedValue",
    "index" : {
      "type" : "http://www.w3.org/2001/XMLSchema#int",
      "@value" : "0"
    },
    "orderedValue" : {
      "uri" : "http://cambridgesemantics.com/Layer/a322d93542f1453e85c1775b77e84fba",
      "type" : "http://cambridgesemantics.com/ontologies/Graphmarts#Layer"
    }
  },
  "loadPriority" : {
    "type" : "http://www.w3.org/2001/XMLSchema#int",
    "@value" : "100"
  },
  "manualRefresh" : true,
  "defaultNamedGraph" : [ {
    "uri" : "http://cambridgesemantics.com/Graphmart/0c09fdcc39d047ddbcf1961bf425f423"
  }, {
    "uri" : "http://cambridgesemantics.com/Layer/a322d93542f1453e85c1775b77e84fba",
    "type" : "http://cambridgesemantics.com/ontologies/Graphmarts#Layer"
  }, {
    "uri" : "http://cambridgesemantics.com/LoadDataStep/9f2a0cfbfa954fd09aaf898ef897dde2",
    "type" : "http://www.w3.org/2002/07/owl#Thing"
  } ],
  "title" : "CSV1 to Server Anzo Data Store - Old Run Graphmart",
  "created" : {
    "type" : "http://www.w3.org/2001/XMLSchema#dateTime",
    "@value" : "2021-07-13T10:55:47.000-04:00"
  },
  "creator" : {
    "uri" : "http://openanzo.org/system/internal/sysadmin",
    "type" : "http://www.w3.org/2002/07/owl#Thing"
  },
  "modified" : {
    "type" : "http://www.w3.org/2001/XMLSchema#dateTime",
    "@value" : "2021-07-23T09:18:39.410-04:00"
  },
  "modifier" : {
    "uri" : "http://openanzo.org/system/internal/sysadmin",
    "type" : "http://www.w3.org/2002/07/owl#Thing"
  }
}

if you see under list of property "defaultNamedGraph"

 {
    "uri" : "http://cambridgesemantics.com/Graphmart/0c09fdcc39d047ddbcf1961bf425f423"
  }

why does it have no type and why does this have wrong type

{
    "uri" : "http://cambridgesemantics.com/LoadDataStep/9f2a0cfbfa954fd09aaf898ef897dde2",
    "type" : "http://www.w3.org/2002/07/owl#Thing"
  }

So I'm wondering why the inconsistency....

Also in this particular use case "http://cambridgesemantics.com/Graphmart/0c09fdcc39d047ddbcf1961bf425f423" is typed "http://cambridgesemantics.com/ontologies/Graphmarts#Graphmart" as well as NamedGraph although that's not reflected in the above data but "defaultNamedGraph" is typed NamedGraph. I'm not sure if there is a way to direct the serialization to force the type. Is there...

The options for this serialization are embed always...

gkellogg commented 2 years ago

Sorry, this is difficult to try to reproduce what you're trying to do. Best would be to use a site such as https://json-ld.org/playground and put a link to illustrate the problem. However, it does not accept any input other than JSON-LD, so you may need to use something like my own http://rdf.greggkellogg.net/distiller to transform the TriG into expanded JSON-LD, and then compact with your context. Or, you can do the whole transformation there, but it doesn't currently provide you with a simple link to paste here.

But, I note that the context you're using contains a set of URLs that don't actually seem to dereference to valid JSON-LD contexts.