本文整理了Java中org.apache.jena.riot.Lang.getContentType()
方法的一些代码示例,展示了Lang.getContentType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lang.getContentType()
方法的具体详情如下:
包路径:org.apache.jena.riot.Lang
类名称:Lang
方法名:getContentType
暂无
代码示例来源:origin: AtomGraph/Core
public MediaType(Lang lang)
{
this(lang.getContentType());
}
代码示例来源:origin: AtomGraph/Core
public MediaType(Lang lang, Map<String, String> parameters)
{
this(lang.getContentType(), parameters);
}
代码示例来源:origin: apache/jena
public static ContentType guessContentType(String resourceName)
{
if ( resourceName == null )
return null ;
Lang lang = filenameToLang(resourceName) ;
if ( lang == null )
return null ;
return lang.getContentType() ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
public static ContentType guessContentType(String resourceName)
{
if ( resourceName == null )
return null ;
Lang lang = filenameToLang(resourceName) ;
if ( lang == null )
return null ;
return lang.getContentType() ;
}
代码示例来源:origin: apache/jena
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);
}
代码示例来源:origin: org.apache.jena/jena-rdfconnection
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);
}
代码示例来源:origin: org.apache.commons/commons-rdf-jena
/**
* 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());
}
代码示例来源:origin: at.researchstudio.sat/won-matcher-service
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();
}
代码示例来源:origin: apache/jena
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 ;
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
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 ;
}
代码示例来源:origin: at.researchstudio.sat/won-matcher-service
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();
}
代码示例来源:origin: apache/jena
/** 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;
}
代码示例来源:origin: apache/jena
/** 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;
}
代码示例来源:origin: org.apache.jena/jena-rdfconnection
/** 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;
}
代码示例来源:origin: org.apache.jena/jena-rdfconnection
/** 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;
}
代码示例来源:origin: apache/jena
/** 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 ;
}
代码示例来源:origin: apache/jena
/** 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 ;
}
}
代码示例来源:origin: org.apache.jena/jena-fuseki-embedded
/** 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 ;
}
}
代码示例来源:origin: org.apache.jena/jena-fuseki-main
/** 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 ;
}
}
代码示例来源:origin: com.github.jsonld-java/jsonld-java-jena
@Test
public void jenaSystem_basic_1() {
assertEquals("name", "JSON-LD", JenaJSONLD.JSONLD.getName());
assertEquals("content-type", "application/ld+json", JenaJSONLD.JSONLD.getContentType()
.getContentType());
}
内容来源于网络,如有侵权,请联系作者删除!