biothings / discovery-app

The Data Discovery Engine project by the CD2H Data working-group
http://discovery.biothings.io
Apache License 2.0
4 stars 9 forks source link

Suggestion: Include schema.org version in resulting json #107

Closed gtsueng closed 1 year ago

gtsueng commented 2 years ago

This way we the user can track the version of schema.org that they built their class from.

gtsueng commented 2 years ago

The schema.org version can be included for each class created within the DDE. It can be included in this fashion:

{
  "@context": {
    "schema": "http://schema.org/",
    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
    "bioschemas": "http://discovery.biothings.io/view/bioschemas/"
  },
  "@graph": [
    {
      "@id": "bioschemas:ComputationalTool",
      "@type": "rdfs:Class",
      "schema:schemaVersion": ["https://schema.org/docs/releases.html#v13.0"],
      "rdfs:comment": "The Life Science Tools specification provides a way to describe bioscience tools and software on the World Wide Web. It defines a set of metadata and vocabularies, built on top of existing technologies and standards, that can be used to represent such tools in Web pages and applications. The goal of the specification is to make it easier to discover. Version 1.0-RELEASE.",
      "rdfs:label": "ComputationalTool",
      "rdfs:subClassOf": {
        "@id": "schema:SoftwareApplication"
      },
newgene commented 1 year ago

As the first step, let's record the schema.org version number in the schema metadata and expose it via the schema API endpoint, then the UI side (schema viewer and editor) can use it to render or create schemas.

gtsueng commented 1 year ago

Schema.org has a json file with the versions and the dates each version was released. https://github.com/schemaorg/schemaorg/blob/main/versions.json We can probably use this file to capture the schema version.

NikkiBytes commented 1 year ago

This feature has been added/merged successfully and exposed through, /api/schema/schema?meta=1

albangaignard commented 1 year ago

Thanks @gtsueng, that's very nice to have the schema.org version exposed. A quick question, why do you write it inside a collection ? Hi thought the cardinality of this property was 1.

gtsueng commented 1 year ago

Schema.org does not define cardinality. Since Bioschemas profiles may be dependent on types that are only in Bioschemas, it's set as an array so that we can include schema.org version and potentially bioschemas type version.