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

How to know result IRI is literal or named node? #40

Closed
pheyvaer opened this issue Apr 27, 2022 · 3 comments
Closed

How to know result IRI is literal or named node? #40

pheyvaer opened this issue Apr 27, 2022 · 3 comments

Comments

@pheyvaer
Copy link

Using the following context and output from the README, how do you if the value of starring in the original data that was queried is a literal or a named node?

{
  "@context": {
    "Film": "http://dbpedia.org/ontology/Film",
    "label": { "@id": "http://www.w3.org/2000/01/rdf-schema#label", "@language": "en" },
    "starring": "http://dbpedia.org/ontology/starring"
  }
}
{
  "data": [
    {
      "id": "http://dbpedia.org/resource/Ocean's_Eleven",
      "starring": "http://dbpedia.org/resource/Brad_Pitt"
    },
    {
      "id": "http://dbpedia.org/resource/The_Favor",
      "starring": "http://dbpedia.org/resource/Brad_Pitt"
    },
    {
      "id": "http://dbpedia.org/resource/The_Assassination_of_Jesse_James_by_the_Coward_Robert_Ford",
      "starring": "http://dbpedia.org/resource/Brad_Pitt"
    },
    {
      "id": "http://dbpedia.org/resource/True_Romance",
      "starring": "http://dbpedia.org/resource/Brad_Pitt"
    },
    ...
  ]
}
@rubensworks
Copy link
Owner

It's been a while since I worked on this, but it looks like this tool is hardcoded to materialize RDF/JS terms to strings, so there's no way of distinguishing literals vs IRIs in that case.

You can however pass your own SparqlJsonToTreeConverter into the constructor: https://github.com/rubensworks/GraphQL-LD.js/blob/master/lib/Client.ts#L119
This allows you to set materializeRdfJsTerms to false: https://github.com/rubensworks/sparqljson-to-tree.js#create-a-new-converter

@pheyvaer
Copy link
Author

Cool! I will have a look at doing it that way. Thanks!

@pheyvaer
Copy link
Author

It worked 🎉

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

No branches or pull requests

2 participants