w3c / hcls-fhir-rdf

Sketching out an RDF representation for FHIR
38 stars 15 forks source link

HAPI FHIR server needs to support Turtle #55

Closed dbooth-boston closed 3 years ago

dbooth-boston commented 7 years ago

It is the most commonly used FHIR server, but it does not yet support Turtle. http://hapifhir.io/ https://github.com/jamesagnew/hapi-fhir/

tian000 commented 5 years ago

+1

dbooth-boston commented 3 years ago

Done! Not sure of the best URI for info, but here's something: https://hapifhir.io/hapi-fhir//apidocs/hapi-fhir-structures-dstu3/org/hl7/fhir/dstu3/utils/formats/Turtle.LineOutputStreamWriter.html

dbooth-boston commented 3 years ago

https://github.com/hapifhir/hapi-fhir/blob/master/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/RDFParserTest.java

ericprud commented 3 years ago

Done! Not sure of the best URI for info, but here's something: https://hapifhir.io/hapi-fhir//apidocs/hapi-fhir-structures-dstu3/org/hl7/fhir/dstu3/utils/formats/Turtle.LineOutputStreamWriter.html

That is a legacy DSTU3 Turtle writer. If someone wants to use RDF with DSTU3, I believe the best thing would be to use FhirContext.newRDFParser, which (as for JSON and XML), both parses:

IBaseResource resource = ctx.newRDFParser().parseResource(inputStream);

and serializes:

String turtle = ctx.newRDFParser().encodeResourceToString(resource);

This parser ca.uhn.fhir.parser.RDFParser has been tested with all R4 and R5 examples.