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

Have an API endpoint, e.g. /ontologies/#{ACRONYM}/#{URI} that returns the JSON-LD for the element with that URI. #66

Closed
2 tasks done
Tracked by #476
syphax-bouazzouni opened this issue Jan 29, 2024 · 6 comments · Fixed by #69 or #72
Closed
2 tasks done
Tracked by #476
Assignees

Comments

@syphax-bouazzouni
Copy link

syphax-bouazzouni commented Jan 29, 2024

Requirements

  • Use the model created in Have a SPARQL query that for a given URI(id) fetches all its related triples ontologies_linked_data#124, to serve an endpoint, called for example /dereference_resource/#{ACRONYM}/#{URI}?output_format= that will return by default JSON-LD or the requested format in the parameter output_format, the returned data will contain all the information of the element with the id URI and is inside the graph of the ontology with the acronym ACRONYM

  • Have a variation of the above endpoint, called for example /dereference_uri/#{URI}?output_format=, where we specify only a URI and an output=format, it will search first in which graph/ontology it is, and then redirect to the above one.

@jonquet
Copy link

jonquet commented Jan 29, 2024

@syphax-bouazzouni Je me pose quand meme une question de comment representer les resultats en JSON-LD pour un triplet ou l'URI de requete est l'objet et non le sujet.

@jonquet
Copy link

jonquet commented Jan 29, 2024

Je crois que ChatGPT viens de me repondre:
Capture d’écran 2024-01-29 à 17 32 09

In JSON-LD, when you want to express RDF triples where a specific term is the object (not the subject), you can use the term as a property in an object and then use the @reverse keyword to indicate that the triple should be reversed. This allows you to express relationships where a given term is the object of the triple.

Here's an example:

{
  "@context": {
    "ex": "http://example.org/"
  },
  "@id": "ex:object",
  "@reverse": {
    "ex:predicate": {
      "@id": "ex:subject"
    }
  }
}

In this example:

  • @context is used to define a namespace prefix (ex) for compact representation of IRIs.
  • @id specifies the object of the RDF statement.
  • @reverse is used to reverse the triple, indicating that the specified term (ex:object) is the object.
  • ex:predicate is the predicate of the statement, and its value is an object with @id representing the URI of the subject.

This structure essentially represents a triple where "ex:subject" has a relationship with "ex:object" through the predicate "ex:predicate," but in JSON-LD, it's expressed from the perspective of the object.

You can adjust the example based on your specific use case, adding more properties or including additional triples as needed.

@jonquet
Copy link

jonquet commented Jan 29, 2024

Purée il est bon ce ChatGPT ;)
Voila la source: https://www.w3.org/TR/json-ld11/#reverse-properties

@syphax-bouazzouni
Copy link
Author

syphax-bouazzouni commented Jan 29, 2024

@syphax-bouazzouni Je me pose quand meme une question de comment representer les resultats en JSON-LD pour un triplet ou l'URI de requête est l'objet et non le sujet

Dans notre cas, l'URI de la requête est toujours le sujet du triplet,
Pour l'example de skos:notes,

?s1 skos:notes ?s2
?s1 ?p1 "example"
?s2 skosxxl:value "note texte"

ont cherche sois ?s1 et on récupère ?s2 et "example". Ou on cherche ?s2 est on récupère "note texte"

une uri est toujours le sujet de quelqu'un

@jonquet
Copy link

jonquet commented Jan 29, 2024

Ben non, pas si tu consideres mon commentaire aussi dans l'issue:
ontoportal-lirmm/ontologies_linked_data#124
C'est tout a fait possible, pour etre complet de récupérer tous les triplets... mais par contre il faut que cela suive dans le JSON aussi.
Si on prends l'exemple évoqué par la doc de JSON, sans faire cela, tu n'auras jamais les informations de qui Homer est parent dans ton ontologie... ta description de Homer sera donc incomplète.

@syphax-bouazzouni
Copy link
Author

Implemented in #69 or #72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment