当前位置: 首页>>代码示例>>Java>>正文


Java RDFLangString类代码示例

本文整理汇总了Java中org.apache.jena.datatypes.xsd.impl.RDFLangString的典型用法代码示例。如果您正苦于以下问题:Java RDFLangString类的具体用法?Java RDFLangString怎么用?Java RDFLangString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RDFLangString类属于org.apache.jena.datatypes.xsd.impl包,在下文中一共展示了RDFLangString类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convert

import org.apache.jena.datatypes.xsd.impl.RDFLangString; //导入依赖的package包/类
/**
 * Convert the literal into natural language.
 * 
 * @param lit
 *            the literal
 * @return the natural language expression
 */
public String convert(LiteralLabel lit) {
	logger.debug("Literal to be converted" + lit.toString());
	
	RDFDatatype dt = lit.getDatatype();
	
	String s = lit.getLexicalForm();
	if (dt == null || dt instanceof RDFLangString) {// plain literal, i.e.
													// omit language tag if
													// exists
		s = lit.getLexicalForm();
		s = s.replaceAll("_", " ");
		s = s.replace('*', ' ');
		s = s.trim();
		if (encapsulateStringLiterals) {
			s = '"' + s + '"';
		}
	} else {// typed literal
		if (dt instanceof XSDDatatype) {// built-in XSD datatype
			if (dt instanceof XSDAbstractDateTimeType) {// date datetypes
				s = convertDateLiteral(lit);
			} else if (encapsulateStringLiterals && dt.equals(XSDDatatype.XSDstring)) {
				s = s.replace('*', ' ');
				s = s.trim();
				s = '"' + s + '"';
			}
		} else {// user-defined datatype
			String text = iriConverter.convert(dt.getURI(), false).toLowerCase();
			String[] split = StringUtils.splitByCharacterTypeCamelCase(text.trim());
			String datatype = Joiner.on(" ").join(Arrays.asList(split).stream().filter(str -> !str.trim().isEmpty())
					.collect(Collectors.toList()));
			s = lit.getLexicalForm() + " " + datatype;
		}
	}
	return s;
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:43,代码来源:LiteralConverterPortuguese.java

示例2: convert

import org.apache.jena.datatypes.xsd.impl.RDFLangString; //导入依赖的package包/类
/**
 * Convert the literal into natural language.
 * @param lit the literal
 * @return the natural language expression
 */
public String convert(LiteralLabel lit) {
    RDFDatatype dt = lit.getDatatype();

    String s = lit.getLexicalForm();
    if (dt == null || dt instanceof RDFLangString) {// plain literal, i.e. omit language tag if exists
        s = lit.getLexicalForm();
        s = s.replaceAll("_", " ");
        if(encapsulateStringLiterals){
        	s = '"' + s + '"';
        }
    } else {// typed literal
        if (dt instanceof XSDDatatype) {// built-in XSD datatype
        	if(dt instanceof XSDAbstractDateTimeType){//date datetypes
        		s = convertDateLiteral(lit);
        	} else if(encapsulateStringLiterals && dt.equals(XSDDatatype.XSDstring)){
	s = '"' + s + '"';
}
        } else {// user-defined datatype
String text = iriConverter.convert(dt.getURI(), false).toLowerCase();
String[] split = StringUtils.splitByCharacterTypeCamelCase(text.trim());
String datatype = Joiner.on(" ").join(Arrays.asList(split).stream().filter(str -> !str.trim().isEmpty()).collect(Collectors.toList()));
s = lit.getLexicalForm() + " " + datatype;
        }
    }
    return s;
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:32,代码来源:LiteralConverter.java

示例3: convert

import org.apache.jena.datatypes.xsd.impl.RDFLangString; //导入依赖的package包/类
/**
 * Convert the literal into natural language.
 * 
 * @param lit
 *            the literal
 * @return the natural language expression
 */
public String convert(LiteralLabel lit) {
	RDFDatatype dt = lit.getDatatype();

	String s = lit.getLexicalForm();
	if (dt == null || dt instanceof RDFLangString) {// plain literal, i.e.
													// omit language tag if
													// exists
		s = lit.getLexicalForm();
		s = s.replaceAll("_", " ");
		if (encapsulateStringLiterals) {
			s = '"' + s + '"';
		}
	} else {// typed literal
		if (dt instanceof XSDDatatype) {// built-in XSD datatype
			if (dt instanceof XSDAbstractDateTimeType) {// date datetypes
				s = convertDateLiteral(lit);
			} else if (encapsulateStringLiterals && dt.equals(XSDDatatype.XSDstring)) {
				s = '"' + s + '"';
			}
		} else {// user-defined datatype
			String text = iriConverter.convert(dt.getURI(), false).toLowerCase();
			String[] split = StringUtils.splitByCharacterTypeCamelCase(text.trim());
			String datatype = Joiner.on(" ").join(Arrays.asList(split).stream().filter(str -> !str.trim().isEmpty())
					.collect(Collectors.toList()));
			s = lit.getLexicalForm() + " " + datatype;
		}
	}
	return s;
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:37,代码来源:LiteralConverterFrench.java


注:本文中的org.apache.jena.datatypes.xsd.impl.RDFLangString类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。