public MediaType(Lang lang) { this(lang.getContentType()); }
public MediaType(Lang lang, Map<String, String> parameters) { this(lang.getContentType(), parameters); }
public static ContentType guessContentType(String resourceName) { if ( resourceName == null ) return null ; Lang lang = filenameToLang(resourceName) ; if ( lang == null ) return null ; return lang.getContentType() ; }
public static ContentType guessContentType(String resourceName) { if ( resourceName == null ) return null ; Lang lang = filenameToLang(resourceName) ; if ( lang == null ) return null ; return lang.getContentType() ; }
protected HttpEntity fileToHttpEntity(String filename, Lang lang) { // Leave RDF/XML to the XML parse, else it's UTF-8. String charset = (lang.equals(Lang.RDFXML) ? null : WebContent.charsetUTF8); // HttpClient Content type. ContentType ct = ContentType.create(lang.getContentType().getContentType(), charset); // Repeatable. return new FileEntity(new File(filename), ct); }
protected HttpEntity fileToHttpEntity(String filename, Lang lang) { // Leave RDF/XML to the XML parse, else it's UTF-8. String charset = (lang.equals(Lang.RDFXML) ? null : WebContent.charsetUTF8); // HttpClient Content type. ContentType ct = ContentType.create(lang.getContentType().getContentType(), charset); // Repeatable. return new FileEntity(new File(filename), ct); }
/** * Return {@link RDFSyntax} corresponding to a Jena {@link Lang}. * * @param lang * {@link Lang} to convert * @return Matched {@link RDFSyntax}, otherwise {@link Optional#empty()} */ public Optional<RDFSyntax> asRDFSyntax(final Lang lang) { return RDFSyntax.byMediaType(lang.getContentType().getContentType()); }
public NeedEvent(String uri, String wonNodeUri, TYPE eventType, long crawlDate, String resource, Lang format) { this.uri = uri; this.wonNodeUri = wonNodeUri; this.eventType = eventType; this.crawlDate = crawlDate; serializedNeedResource = resource; serializationLangName = format.getName(); serializationLangContentType = format.getContentType().getContentType(); }
public String toLongString() { String x = "Lang:" + label + " " + getContentType() ; if (getAltNames().size() > 0) x = x + " " + getAltNames() ; if (getAltContentTypes().size() > 0) x = x + " " + getAltContentTypes() ; if (getFileExtensions().size() > 0) x = x + " " + getFileExtensions() ; return x ; } }
public String toLongString() { String x = "Lang:" + label + " " + getContentType() ; if (getAltNames().size() > 0) x = x + " " + getAltNames() ; if (getAltContentTypes().size() > 0) x = x + " " + getAltContentTypes() ; if (getFileExtensions().size() > 0) x = x + " " + getFileExtensions() ; return x ; }
public NeedEvent(String uri, String wonNodeUri, TYPE eventType, long crawlDate, Dataset ds) { this.uri = uri; this.wonNodeUri = wonNodeUri; this.eventType = eventType; this.crawlDate = crawlDate; StringWriter sw = new StringWriter(); RDFDataMgr.write(sw, ds, RDFFormat.TRIG.getLang()); serializedNeedResource = sw.toString(); serializationLangName = RDFFormat.TRIG.getLang().getName(); serializationLangContentType = RDFFormat.TRIG.getLang().getContentType().getContentType(); }
/** Create an HttpEntity for the graph */ protected HttpEntity graphToHttpEntity(Graph graph, RDFFormat syntax) { EntityTemplate entity = new EntityTemplate((out)->RDFDataMgr.write(out, graph, syntax)); String ct = syntax.getLang().getContentType().getContentType(); entity.setContentType(ct); return entity; }
/** Create an HttpEntity for the dataset */ protected HttpEntity datasetToHttpEntity(DatasetGraph dataset, RDFFormat syntax) { EntityTemplate entity = new EntityTemplate((out)->RDFDataMgr.write(out, dataset, syntax)); String ct = syntax.getLang().getContentType().getContentType(); entity.setContentType(ct); return entity; }
/** Create an HttpEntity for the dataset */ protected HttpEntity datasetToHttpEntity(DatasetGraph dataset, RDFFormat syntax) { EntityTemplate entity = new EntityTemplate((out)->RDFDataMgr.write(out, dataset, syntax)); String ct = syntax.getLang().getContentType().getContentType(); entity.setContentType(ct); return entity; }
/** Create an HttpEntity for the graph */ protected HttpEntity graphToHttpEntity(Graph graph, RDFFormat syntax) { EntityTemplate entity = new EntityTemplate((out)->RDFDataMgr.write(out, graph, syntax)); String ct = syntax.getLang().getContentType().getContentType(); entity.setContentType(ct); return entity; }
/** Create an HttpEntity for the graph */ protected static HttpEntity graphToHttpEntity(final Graph graph) { final RDFFormat syntax = RDFFormat.TURTLE_BLOCKS ; ContentProducer producer = new ContentProducer() { @Override public void writeTo(OutputStream out) { RDFDataMgr.write(out, graph, syntax) ; } } ; EntityTemplate entity = new EntityTemplate(producer) ; ContentType ct = syntax.getLang().getContentType() ; entity.setContentType(ct.getContentType()) ; return entity ; }
/** Create an HttpEntity for the graph */ protected static HttpEntity graphToHttpEntity(final Graph graph) { final RDFFormat syntax = RDFFormat.TURTLE_BLOCKS ; ContentProducer producer = new ContentProducer() { @Override public void writeTo(OutputStream out) { RDFDataMgr.write(out, graph, syntax) ; } } ; EntityTemplate entity = new EntityTemplate(producer) ; ContentType ct = syntax.getLang().getContentType() ; entity.setContentType(ct.getContentType()) ; return entity ; } }
/** Create an HttpEntity for the graph */ protected static HttpEntity graphToHttpEntity(final Graph graph) { final RDFFormat syntax = RDFFormat.TURTLE_BLOCKS ; ContentProducer producer = new ContentProducer() { @Override public void writeTo(OutputStream out) { RDFDataMgr.write(out, graph, syntax) ; } } ; EntityTemplate entity = new EntityTemplate(producer) ; ContentType ct = syntax.getLang().getContentType() ; entity.setContentType(ct.getContentType()) ; return entity ; } }
/** Create an HttpEntity for the graph */ protected static HttpEntity graphToHttpEntity(final Graph graph) { final RDFFormat syntax = RDFFormat.TURTLE_BLOCKS ; ContentProducer producer = new ContentProducer() { @Override public void writeTo(OutputStream out) { RDFDataMgr.write(out, graph, syntax) ; } } ; EntityTemplate entity = new EntityTemplate(producer) ; ContentType ct = syntax.getLang().getContentType() ; entity.setContentType(ct.getContentType()) ; return entity ; } }
@Test public void jenaSystem_basic_1() { assertEquals("name", "JSON-LD", JenaJSONLD.JSONLD.getName()); assertEquals("content-type", "application/ld+json", JenaJSONLD.JSONLD.getContentType() .getContentType()); }