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

Address JSON-LD being an array of 1 or more graphs #128

Closed
fils opened this issue Dec 15, 2022 · 7 comments
Closed

Address JSON-LD being an array of 1 or more graphs #128

fils opened this issue Dec 15, 2022 · 7 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@fils
Copy link
Member

fils commented Dec 15, 2022

In cases like at:

https://oceanscape.org/organisation/deep-ocean-stewardship-initiative/

[{
	"@context": "https://schema.org",
	"@type": "Organization",
	"@id": "https://oceanscape.org/organisation/deep-ocean-stewardship-initiative/#Organization",
	"url": "https://oceanscape.org/organisation/deep-ocean-stewardship-initiative/",
	"description": "",
	"name": "Deep-Ocean Stewardship Initiative",
	"address": {
		"streetAddress": "University of Southampton, Waterfront Campus, European Way, Southampton, UK",
		"addressCountry": ""
	},
	"logo": "https://oceanscape.org/wp-content/uploads/2019/09/DOSI-Logo.jpg",
	"knowsAbout": "Advocating for (ocean) science, Defining strategies/road maps/priorities for Earth (ocean) observing/science, Providing scientific advice for policy makers"
}]

This array could be 1 or more graphs.

Gleaner needs to detect arrays and then process each item.

Related, could we provide a list of top level types to index? This would require introspection and be slow, so really this should be in Nabu.

@nein09
Copy link
Collaborator

nein09 commented Dec 15, 2022

Some of the things I'm indexing for POLDER search are like this, and it seems to work okay, but it's shaped slightly differently. I'm thinking specifically of http://hedeby.uwaterloo.ca/api/metadata?page=1 and its subsequent pages.

@valentinedwv
Copy link
Member

valentinedwv commented Dec 30, 2022

Yes, EC sees things that are being done as 'DataCatalog's so they contain multiple 'Datasets' and that needs to be handled in some manner.

https://raw.githubusercontent.com/earthcube/GeoCODES-Metadata/93def90d5aa853779744eb7110e3ad674a551187/metadata/Dataset/json/MB_cchdo_49SU9402_2.json

@valentinedwv
Copy link
Member

#121 is another example

@fils
Copy link
Member Author

fils commented Jan 19, 2023

@nein09 So graphs shaped like the following are working OK for you? The example you shared doesn't have the root level [] surrounding the package though. That is the issue that is showing up.

@valentinedwv I have a fix for this sitting in some off-line code, I can work this in.

source: view-source:https://pogo-ocean.org/pogo-member/ird-institut-de-recherche-pour-le-developpement/

[{
	"@context": "https://schema.org/",
	"@type": "Organization",
	"name": "Partnership for Observation of the Global Ocean",
	"url": "https://www.ird.fr/",
	"sameAs": [],
	"logo": {
		"@type": "ImageObject",
		"url": "https://pogo-ocean.org/wp-content/uploads/2022/10/logo_IRD_2016_LONGUEUR_FR_BLANC_coloured.png",
		"width": 1451,
		"height": 337
	},
	"address": {
		"streetAddress": "Research Institute for Development, Boulevard de Dunkerque, Marseille, France"
	},
	"image": [{
		"@type": "ImageObject",
		"@id": "https://pogo-ocean.org/pogo-member/ird-institut-de-recherche-pour-le-developpement/#primaryimage",
		"url": "https://pogo-ocean.org/wp-content/uploads/2022/10/logo_IRD_2016_LONGUEUR_FR_BLANC_coloured.png",
		"width": "1451",
		"height": "337"
	}]
}]

@fils fils self-assigned this Jan 19, 2023
@fils fils added bug Something isn't working enhancement New feature or request labels Jan 19, 2023
@nein09
Copy link
Collaborator

nein09 commented Jan 19, 2023

@fils I'm not sure- I can tell you that something like this is fine, though:

{
 "@context": {
   "@vocab":"https://schema.org/"
  }, 
  "@type":"ItemList", 
  "itemListElement": [
   { 
      "@type":"ListItem", 
      "position":1, 
      "item":{ 
           "@type":"Dataset",
           "name": "dataset name" // it looks like they usually do inside here
       },
   },
   { "@type":"ListItem", "position":2, "item":{ "@type":"Dataset", ... you get the idea }
   }
  ]
}

@fils
Copy link
Member Author

fils commented Mar 16, 2023

This issue seems to be in the file https://github.com/gleanerio/gleaner/blob/dev/internal/summoner/acquire/jsonutils.go where isValid and addToJsonListIfValid needs to address the [json] approach

@valentinedwv
Copy link
Member

valentinedwv commented May 2, 2023

opencore?

[
  {
    "@graph": [
      {
        "@id": "_:bbj6sl3ntr9b9lop9uoig",
        "@type": [
          "https://schema.org/PropertyValue"
        ],
        "https://schema.org/propertyID": [
          {
            "@value": "SHA256"
          }
        ],
        "https://schema.org/value": [
          {
            "@value": "000355176249738e6b0530130d21c9051c30b1ca865bd52b2ee75343e9986c73"
          }
        ]
      },
      {
        "@id": "https://opencoredata.org/id/csdco/do/000355176249738e6b0530130d21c9051c30b1ca865bd52b2ee75343e9986c73",
        "@type": [
          "http://www.schema.org/DigitalDocument"
        ],
        "https://schema.org/additionType": [
          {
            "@id": "https://opencoredata.org/voc/csdco/v1/ICDFiles"
          }
        ],
        "https://schema.org/dateCreated": [
          {
            "@value": "2004-03-10"
          }
        ],
        "https://schema.org/description": [
          {
            "@value": "Digital object of type ICD named GLAD2-LT01-2A-13H-2.pdf for CSDCO project GLAD2"
          }
        ],
        "https://schema.org/encodingFormat": [
          {
            "@value": "application/pdf"
          }
        ],
        "https://schema.org/identifier": [
          {
            "@id": "_:bbj6sl3ntr9b9lop9uoig"
          }
        ],
        "https://schema.org/isRelatedTo": [
          {
            "@value": "GLAD2"
          }
        ],
        "https://schema.org/license": [
          {
            "@id": "http://example.com/cc0.html"
          }
        ],
        "https://schema.org/name": [
          {
            "@value": "GLAD2-LT01-2A-13H-2.pdf"
          }
        ],
        "https://schema.org/url": [
          {
            "@id": "https://opencoredata.org/id/csdco/do/000355176249738e6b0530130d21c9051c30b1ca865bd52b2ee75343e9986c73"
          }
        ]
      }
    ],
    "@id": "https://opencoredata.org/objectgraph/id/000355176249738e6b0530130d21c9051c30b1ca865bd52b2ee75343e9986c73"
  }
]


** errors **

{"contentType":"json or ld_json","file":"/Users/valentin/development/dev_earthcube/gleanerio/gleaner/internal/summoner/acquire/acquire.go:243","func":"github.com/gleanerio/gleaner/internal/summoner/acquire.FindJSONInResponse","level":"error","msg":"Error processing json response from https://opencoredata.org/id/csdco/do/017f759f3ad12d047a10e192fb416f5a387db9f4e723cdb82cd36be70ddd4c47.jsonlderror checking for valid json: Error in unmarshaling json: json: cannot unmarshal array into Go value of type map[string]interface {}","time":"2023-05-02T19:34:58Z","url":"https://opencoredata.org/id/csdco/do/017f759f3ad12d047a10e192fb416f5a387db9f4e723cdb82cd36be70ddd4c47.jsonld"}
{"contentType":"json or ld_json","file":"/Users/valentin/development/dev_earthcube/gleanerio/gleaner/internal/summoner/acquire/acquire.go:243","func":"github.com/gleanerio/gleaner/internal/summoner/acquire.FindJSONInResponse","level":"error","msg":"Error processing json response from https://opencoredata.org/id/csdco/do/018db36337e931d232f7d7bbb73fd624c8e0fadb48d7aa4c6d4c70c780f08294.jsonlderror checking for valid json: Error in unmarshaling json: json: cannot unmarshal array into Go value of type map[string]interface {}","time":"2023-05-02T19:34:58Z","url":"https://opencoredata.org/id/csdco/do/018db36337e931d232f7d7bbb73fd624c8e0fadb48d7aa4c6d4c70c780f08294.jsonld"}

valentinedwv added a commit that referenced this issue May 3, 2023
Prep for json profiles #163
#128. For Validation just unmarshal an interface
valentinedwv added a commit that referenced this issue May 3, 2023
Prep for json profiles #163
#128. For Validation just unmarshal an interface
valentinedwv added a commit that referenced this issue May 3, 2023
Prep for json profiles #163
#128. For Validation just unmarshal an interface
valentinedwv added a commit that referenced this issue May 9, 2023
Prep for json profiles #163
#128. For Validation just unmarshal an interface
valentinedwv added a commit that referenced this issue Aug 31, 2023
* accept content types #192.
Prep for json profiles #163



* accept content types #192.
Prep for json profiles #163
#128. For Validation just unmarshal an interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants