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

explain the context attribute #36

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jamesscottbrown
Copy link
Contributor

No description provided.

@rpgoldman
Copy link
Collaborator

I don't think that description for context can be correct. For example, asking for a set of instances, I get

{
  "@id": "https://sift.net/container-ontology/container-ontology#Plate",
  "hasInstance": <....>,
  "@context": "https://owlery.phenoscape.org/json/context.jsonld"
}

I really don't know what that @context field is supposed to be.

@jamesscottbrown
Copy link
Contributor Author

jamesscottbrown commented Apr 29, 2022

I don't think that description for context can be correct.

Why not? I think it is consistent with the response.

If I fetch the URL https://owlery.phenoscape.org/json/context.jsonld, the response is:

{
  "@context": {
    "equivalentClass": {
      "@id": "http://www.w3.org/2002/07/owl#equivalentClass",
      "@type": "@id"
    },
    "subClassOf": {
      "@id": "http://www.w3.org/2000/01/rdf-schema#subClassOf",
      "@type": "@id"
    },
    "superClassOf": {
      "@reverse": "http://www.w3.org/2000/01/rdf-schema#subClassOf",
      "@type": "@id"
    },
    "type": "@type",
    "hasInstance": {
      "@reverse": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
      "@type": "@id"
    },
    "isSatisfiable": {
      "@id": "http://purl.org/phenoscape/owlery.owl#isSatisfiable",
      "@type": "http://www.w3.org/2001/XMLSchema#boolean"
    },
    "value": {
      "@id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#value"
    },
    "version": {
      "@id": "http://www.w3.org/2002/07/owl#versionIRI",
      "@type": "@id"
    },
    "imports": {
      "@id": "http://www.w3.org/2002/07/owl#imports",
      "@type": "@id"
    }
  }
}

Within this, the hasInstance attribute has the value:

 {
      "@reverse": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
      "@type": "@id"
}

Fetching http://www.w3.org/1999/02/22-rdf-syntax-ns#type, I see it is defined as:

rdf:type a rdf:Property ;
	rdfs:isDefinedBy <http://www.w3.org/1999/02/22-rdf-syntax-ns#> ;
	rdfs:label "type" ;
	rdfs:comment "The subject is an instance of a class." ;
	rdfs:range rdfs:Class ;
	rdfs:domain rdfs:Resource .

So it seems that the context.jsonld file is defining hasInstance (in the context of the API's repsonse) to be the reverse of rdf:type (which is defined as "The subject is an instance of a class.").

In other words, this is saying that that x hasInstance y means that y is an instance of class x. This seems to be consistent with the API response: the hasInstance attribute of the response contains a list of things which are instances of container-ontology:Plate - i.e., things which are of type container-ontology:Plate.

@jamesscottbrown
Copy link
Contributor Author

This is a similar example in the JSON-LD spec: https://json-ld.org/spec/latest/json-ld/#example-55-using-reverse-to-define-reverse-properties

@rpgoldman
Copy link
Collaborator

OK, I think I see: @context is a JSON LD thing. The context it provides is something like a namespace import. It tells us how to interpret the use of the property "hasInstance" that appears in the query response without a namespace IRI.

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

Successfully merging this pull request may close these issues.

None yet

2 participants