does pyld support content negotiation?
Opened this issue · 2 comments
I am trying to run pyld functions (expand, normalize) on the document below but it doesn't seem to get the context urls linked.
doc = {
"@context": [
"https://schema.repronim.org/rl/contexts/generic",
"https://schema.repronim.org/rl/activities/PHQ-9/phq9_context"
],
"@type": "reproschema:Activity",
"@id": "phq9_schema",
"skos:prefLabel": "PHQ-9 Assessment",
"schema:description": "PHQ-9 assessment schema",
"schema:citation": "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1495268/",
"preamble": {
"en": "Over the last 2 weeks, how often have you been bothered by any of the following problems?",
"es": "Durante las últimas 2 semanas, ¿con qué frecuencia le han molestado los siguintes problemas?"
}
}
normalized_file = jsonld.normalize(doc, {'algorithm': 'URDNA2015', 'format': 'application/n-quads'})
This doesn't work on the JSON-LD playground either.
how can I make this work? Does pyld support content negotiation/Is there a way to force accept-header?
Seems like this is a problem with schema.org contexts as well (schemaorg/schemaorg#2578 (comment))
I was stuck in the same problem. Ended up using requests to get the context JSON separately and assign it to @context key at runtime. Then the pyld functions work!
Hope this helps
"https://schema.repronim.org/rl/activities/PHQ-9/phq9_context" is returning 405 as of today. Removing that URL and playground or pyld can expand things. If you want the normalize call to work the "@id": "phq9_schema"
needs to be a valid URI. If you change that to "@id": "urn:phq9_schema"
, you'll get output.