use of org.eclipse.rdf4j.rio.RDFFormat in project opentheso by miledrousset.
the class RestRDFHelper method exportConceptHdl.
/**
* Permet de retourner un concept au format défini en passant par un identifiant Handle
* utilisé pour la négociation de contenu
*
* @param ds
* @param handleId
* @param format
* @return
*/
public String exportConceptHdl(HikariDataSource ds, String handleId, String format) {
RDFFormat rDFFormat = getRDFFormat(format);
WriteRdf4j writeRdf4j = getConceptFromHandle(ds, handleId);
if (writeRdf4j == null)
return null;
ByteArrayOutputStream out;
out = new ByteArrayOutputStream();
Rio.write(writeRdf4j.getModel(), out, rDFFormat);
return out.toString();
}
use of org.eclipse.rdf4j.rio.RDFFormat in project opentheso by miledrousset.
the class RestRDFHelper method exportConceptFromId.
/**
* Permet de retourner un concept au format défini en passant par l'identifiant du concept
* utilisé pour la négociation de contenu
*
* @param ds
* @param idConcept
* @param idTheso
* @param format
* @return
*/
public String exportConceptFromId(HikariDataSource ds, String idConcept, String idTheso, String format) {
RDFFormat rDFFormat = getRDFFormat(format);
WriteRdf4j writeRdf4j = getConceptFromId(ds, idConcept, idTheso);
if (writeRdf4j == null)
return null;
ByteArrayOutputStream out;
out = new ByteArrayOutputStream();
Rio.write(writeRdf4j.getModel(), out, rDFFormat);
return out.toString();
}
use of org.eclipse.rdf4j.rio.RDFFormat in project opentheso by miledrousset.
the class RestRDFHelper method findNotation.
/**
* Permet de retourner les concepts qui correspondent à la notation
* utilisé pour la négociation de contenu
*
* @param ds
* @param idTheso
* @param format
* @param value
* @return
*/
public String findNotation(HikariDataSource ds, String idTheso, String value, String format) {
RDFFormat rDFFormat = getRDFFormat(format);
WriteRdf4j writeRdf4j = findNotation__(ds, value, idTheso);
if (writeRdf4j == null)
return null;
ByteArrayOutputStream out;
out = new ByteArrayOutputStream();
Rio.write(writeRdf4j.getModel(), out, rDFFormat);
return out.toString();
}
use of org.eclipse.rdf4j.rio.RDFFormat in project opentheso by miledrousset.
the class RestRDFHelper method brancheOfConceptsDown.
/**
* Fonction qui permet de récupérer une branche complète en partant d'un
* concept et en allant jusqu'à la fin (vers le bas)
*
* @param ds
* @param idConcept
* @param idTheso
* @param format
* @return skos
*/
public String brancheOfConceptsDown(HikariDataSource ds, String idConcept, String idTheso, String format) {
RDFFormat rDFFormat = getRDFFormat(format);
WriteRdf4j writeRdf4j = brancheOfConceptsDown__(ds, idConcept, idTheso);
if (writeRdf4j == null)
return null;
ByteArrayOutputStream out;
out = new ByteArrayOutputStream();
Rio.write(writeRdf4j.getModel(), out, rDFFormat);
return out.toString();
}
use of org.eclipse.rdf4j.rio.RDFFormat in project opentheso by miledrousset.
the class exportConceptTest method exportConcept.
@Test
public void exportConcept() {
String idTheso = "TH_1";
String idArk = "26678/pcrtj2nMTJw5fg";
String format = "text/turtle";
RDFFormat rDFFormat = null;
String extention = "";
switch(format) {
case "application/rdf+xml":
rDFFormat = RDFFormat.RDFXML;
extention = ".rdf";
break;
case "application/ld+json":
rDFFormat = RDFFormat.JSONLD;
extention = ".jsonld";
break;
case "text/turtle":
rDFFormat = RDFFormat.TURTLE;
extention = ".ttl";
break;
case "application/json":
rDFFormat = RDFFormat.RDFJSON;
extention = ".json";
break;
}
WriteRdf4j writeRdf4j = loadExportHelper(idTheso, idArk);
ByteArrayOutputStream out;
out = new ByteArrayOutputStream();
Rio.write(writeRdf4j.getModel(), out, rDFFormat);
System.out.println(out.toString());
// file = new ByteArrayContent(out.toByteArray(), "application/xml", idTheso + " " + extention);
}
Aggregations