本文整理了Java中org.apache.jena.riot.Lang.equals()
方法的一些代码示例,展示了Lang.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lang.equals()
方法的具体详情如下:
包路径:org.apache.jena.riot.Lang
类名称:Lang
方法名:equals
暂无
代码示例来源:origin: apache/jena
@Override
public ResultSetWriter create(Lang lang) {
lang = Objects.requireNonNull(lang, "Language must not be null");
// if ( lang.equals(SPARQLResultSetXML) ) return writerXML;
// if ( lang.equals(SPARQLResultSetJSON) ) return writerJSON;
if ( lang.equals(SPARQLResultSetCSV) ) return writerCSV;
if ( lang.equals(SPARQLResultSetTSV) ) return writerTSV;
if ( lang.equals(SPARQLResultSetText) ) return writerText;
if ( lang.equals(SPARQLResultSetNone) ) return writerNone;
throw new RiotException("Lang not registered (ResultSet writer)") ;
}
}
代码示例来源:origin: apache/jena
@Override
public ResultSetReader create(Lang lang) {
lang = Objects.requireNonNull(lang, "Language must not be null") ;
// if ( lang.equals(SPARQLResultSetXML) ) return readerXML ;
// if ( lang.equals(SPARQLResultSetJSON) ) return readerJSON ;
if ( lang.equals(SPARQLResultSetCSV) ) return readerCSV ;
if ( lang.equals(SPARQLResultSetTSV) ) return readerTSV ;
throw new RiotException("Lang not registered (ResultSet reader)") ;
}
}
代码示例来源:origin: apache/jena
/** Create a template from a String */
public static String templateString(String template, Map<String, String> params, Lang lang) {
for ( Entry<String, String> e : params.entrySet() ) {
// Literal string replacement.
// If using .replaceAll, need to use Match.quoteReplacement on the value.
String x = e.getValue() ;
String k = "{"+e.getKey()+"}" ;
if ( lang != null ) {
if ( Lang.TTL.equals(lang) ||
Lang.TRIG.equals(lang) ||
Lang.NT.equals(lang) ||
Lang.NQ.equals(lang) ||
Lang.JSONLD.equals(lang) ||
Lang.RDFJSON.equals(lang)
) {
// Make safe for a RDF language ""-string - especially MS Windows \ path separators.
x = x.replace("\\", "\\\\") ;
x = x.replace("\"", "\\\"") ;
}
}
template = template.replace(k, x) ;
}
return template ;
}
}
代码示例来源:origin: org.apache.jena/jena-fuseki-webapp
/** Create a template from a String */
public static String templateString(String template, Map<String, String> params, Lang lang) {
for ( Entry<String, String> e : params.entrySet() ) {
// Literal string replacement.
// If using .replaceAll, need to use Match.quoteReplacement on the value.
String x = e.getValue() ;
String k = "{"+e.getKey()+"}" ;
if ( lang != null ) {
if ( Lang.TTL.equals(lang) ||
Lang.TRIG.equals(lang) ||
Lang.NT.equals(lang) ||
Lang.NQ.equals(lang) ||
Lang.JSONLD.equals(lang) ||
Lang.RDFJSON.equals(lang)
) {
// Make safe for a RDF language ""-string - especially MS Windows \ path separators.
x = x.replace("\\", "\\\\") ;
x = x.replace("\"", "\\\"") ;
}
}
template = template.replace(k, x) ;
}
return template ;
}
}
代码示例来源:origin: AtomGraph/Core
public static List<javax.ws.rs.core.MediaType> getRegistered()
{
List<javax.ws.rs.core.MediaType> mediaTypes = new ArrayList<>();
Iterator<Lang> it = RDFLanguages.getRegisteredLanguages().iterator();
while (it.hasNext())
{
Lang lang = it.next();
if (!lang.equals(Lang.RDFNULL)) mediaTypes.add(new MediaType(lang));
}
return mediaTypes;
}
代码示例来源: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: stackoverflow.com
public static void main(String[] args) {
Lang obj1 = new Lang();
Lang obj2 = new Lang();
if (obj1.equals(obj2)) {
System.out.println("Both Lang objects are equal.");
}
}
代码示例来源: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: apache/jena
@Override
public ReaderRIOT create(Lang language, ParserProfile profile) {
if ( !Lang.JSONLD.equals(language) )
throw new InternalErrorException("Attempt to parse " + language + " as JSON-LD") ;
return new JsonLDReader(language, profile, profile.getErrorHandler());
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
@Override
public RDFReader getReader(String langname)
{
// If RDF/XML, then return an ARP
Lang lang = RDFLanguages.nameToLang(langname) ;
if ( RDFLanguages.RDFXML.equals(lang) )
return new RDFReaderRIOT_ARP() ;
return new RDFReaderRIOT(langname) ;
}
代码示例来源:origin: apache/jena
private static void checkRegistration(Lang lang)
{
if ( lang == null )
return ;
String label = canonicalKey(lang.getLabel()) ;
Lang lang2 = mapLabelToLang.get(label) ;
if ( lang2 == null )
return ;
if ( lang.equals(lang2) )
return ;
// Content type.
if ( mapContentTypeToLang.containsKey(lang.getContentType().getContentType()))
{
String k = lang.getContentType().getContentType() ;
error("Language overlap: " +lang+" and "+mapContentTypeToLang.get(k)+" on content type "+k) ;
}
for (String altName : lang.getAltNames() )
if ( mapLabelToLang.containsKey(altName) )
error("Language overlap: " +lang+" and "+mapLabelToLang.get(altName)+" on name "+altName) ;
for (String ct : lang.getAltContentTypes() )
if ( mapContentTypeToLang.containsKey(ct) )
error("Language overlap: " +lang+" and "+mapContentTypeToLang.get(ct)+" on content type "+ct) ;
for (String ext : lang.getFileExtensions() )
if ( mapFileExtToLang.containsKey(ext) )
error("Language overlap: " +lang+" and "+mapFileExtToLang.get(ext)+" on file extension type "+ext) ;
}
代码示例来源:origin: apache/jena
String charset = (lang.equals(Lang.RDFXML) ? null : WebContent.charsetUTF8);
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
private static void checkRegistration(Lang lang)
{
if ( lang == null )
return ;
String label = canonicalKey(lang.getLabel()) ;
Lang lang2 = mapLabelToLang.get(label) ;
if ( lang2 == null )
return ;
if ( lang.equals(lang2) )
return ;
// Content type.
if ( mapContentTypeToLang.containsKey(lang.getContentType().getContentType()))
{
String k = lang.getContentType().getContentType() ;
error("Language overlap: " +lang+" and "+mapContentTypeToLang.get(k)+" on content type "+k) ;
}
for (String altName : lang.getAltNames() )
if ( mapLabelToLang.containsKey(altName) )
error("Language overlap: " +lang+" and "+mapLabelToLang.get(altName)+" on name "+altName) ;
for (String ct : lang.getAltContentTypes() )
if ( mapContentTypeToLang.containsKey(ct) )
error("Language overlap: " +lang+" and "+mapContentTypeToLang.get(ct)+" on content type "+ct) ;
for (String ext : lang.getFileExtensions() )
if ( mapFileExtToLang.containsKey(ext) )
error("Language overlap: " +lang+" and "+mapFileExtToLang.get(ext)+" on file extension type "+ext) ;
}
代码示例来源:origin: org.apache.jena/jena-rdfconnection
String charset = (lang.equals(Lang.RDFXML) ? null : WebContent.charsetUTF8);
代码示例来源:origin: org.fcrepo/fcrepo-http-commons
private static void serializeNonStreamed(final RdfStream rdfStream, final OutputStream output,
final Lang dataFormat, final MediaType dataMediaType, final Map<String, String> nsPrefixes) {
final Model model = rdfStream.collect(toModel());
model.setNsPrefixes(filterNamespacesToPresent(model, nsPrefixes));
// use block output streaming for RDFXML
if (RDFXML.equals(dataFormat)) {
RDFDataMgr.write(output, model.getGraph(), RDFXML_PLAIN);
} else if (JSONLD.equals(dataFormat)) {
final RDFFormat jsonldFormat = getFormatFromMediaType(dataMediaType);
RDFDataMgr.write(output, model.getGraph(), jsonldFormat);
} else {
RDFDataMgr.write(output, model.getGraph(), dataFormat);
}
}
代码示例来源:origin: apache/jena
@Test
public void testFileExtensionsProvided()
{
for (Lang l : RDFLanguages.getRegisteredLanguages() )
{
if ( RDFLanguages.RDFNULL.equals(l) )
continue ;
if ( ResultSetLang.SPARQLResultSetNone.equals(l) )
continue ;
Assert.assertNotNull( l+" does not have file extensions defined", l.getFileExtensions());
Assert.assertTrue( l+" does not have file extensions defined", l.getFileExtensions().size() > 0);
}
}
代码示例来源:origin: apache/jena
@Test public void writer08() {
if ( format.getLang().equals(Lang.JSONLD) )
// Broken for JSON-LD (json-ld-java 0.5.0)
return ;
test("writer-rt-28.trig") ;
}
@Test public void writer09() { test("writer-rt-29.trig") ; }
代码示例来源:origin: apache/jena
@SuppressWarnings("deprecation")
@Test public void jenaSystem_read_2() {
if ( ! Lang.RDFNULL.equals(lang) ) {
assertTrue(RDFParserRegistry.isRegistered(lang));
assertNotNull(RDFParserRegistry.getFactory(lang)) ;
}
}
代码示例来源:origin: apache/jena
@Test public void test_resultset_01() {
// write(data)-read-compare
ByteArrayOutputStream out = new ByteArrayOutputStream() ;
ResultSetMgr.write(out, test_rs, lang) ;
test_rs.reset();
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()) ;
ResultSet rs = ResultSetMgr.read(in, lang) ;
ResultSetRewindable rsw = ResultSetFactory.makeRewindable(rs) ;
if ( ! lang.equals(SPARQLResultSetCSV) )
// CSV is not faithful
assertTrue(ResultSetCompare.equalsByTerm(test_rs, rsw)) ;
rsw.reset();
test_rs.reset();
out = new ByteArrayOutputStream() ;
// Round trip the output from above - write(rsw)-read-compare
ResultSetMgr.write(out, rsw, lang) ;
in = new ByteArrayInputStream(out.toByteArray()) ;
ResultSet rs2 = ResultSetMgr.read(in, lang) ;
// Not test_rs -- CSV round-trips to itself.
assertTrue(ResultSetCompare.equalsByTerm(rsw, rs2)) ;
}
代码示例来源:origin: apache/jena
RDFDataMgr.write(out, dsg, fmt) ;
} catch (JenaException ex) {
if ( fmt.getLang().equals(Lang.RDFXML) )
ServletOps.errorBadRequest("Failed to write output in RDF/XML: "+ex.getMessage()) ;
else
内容来源于网络,如有侵权,请联系作者删除!