本文整理汇总了Java中com.hp.hpl.jena.datatypes.xsd.XSDDatatype.XSDboolean方法的典型用法代码示例。如果您正苦于以下问题:Java XSDDatatype.XSDboolean方法的具体用法?Java XSDDatatype.XSDboolean怎么用?Java XSDDatatype.XSDboolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.datatypes.xsd.XSDDatatype
的用法示例。
在下文中一共展示了XSDDatatype.XSDboolean方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toLightString
import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; //导入方法依赖的package包/类
/**
* Convert a resource to its string representation and try to replace the namespace by its prefix (or remove it if it's the default one).<br/>
* It uses {@link #contract(String)} to replace or remove the namespace.<br/>
* If the prefix for the namespace is unknown, complete URI is returned.
*
* @param res The RDFNode which is to output as a string.
* @return The literal representation of the resource, with short namespace (or no namespace if it is the default one).
*/
public static String toLightString(final RDFNode res)
{
if (res.isAnon()) return "anonymousNode_" + res.toString();
if (res.isResource() && ((Resource)res).getURI() != null)
return contract(((Resource)res).getURI());
if (res.isLiteral())
{
Literal lit = (Literal)res;
if (lit.getDatatype() == XSDDatatype.XSDdouble ||
lit.getDatatype() == XSDDatatype.XSDint ||
lit.getDatatype() == XSDDatatype.XSDboolean)
return lit.getLexicalForm();
if (lit.getDatatype() == null) //plain literal
return lit.getLexicalForm();
return "'" + lit.getLexicalForm() + "'^^" + contract((lit).getDatatypeURI());
}
return res.toString();
}
示例2: flattenNode
import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; //导入方法依赖的package包/类
public Object flattenNode(Object o) {
if(!(o instanceof Literal))
return o;
Literal that=(Literal) o;
RDFDatatype t=that.getDatatype();
if (t== XSDDatatype.XSDfloat)
return that.getFloat();
if (t== XSDDatatype.XSDdouble)
return that.getDouble();
if (t== XSDDatatype.XSDinteger || t==XSDDatatype.XSDint)
return that.getInt();
if (t==XSDDatatype.XSDlong)
return that.getLong();
if (t==XSDDatatype.XSDshort)
return that.getShort();
if (t==XSDDatatype.XSDboolean)
return that.getBoolean();
if (t==XSDDatatype.XSDstring)
return that.getString();
// XXX -- it would be nice to have support for decimal, datetime, etc.
// one of the harder things to what to do about language tags... in some cases we want to deep
// six them, other times we want to keep them
return that;
}
示例3: literalToSparqlSyntax
import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; //导入方法依赖的package包/类
/**
* Formats a literal to a SPARQL-compatible string.
* @param lit a literal to be formatted
* @return a string representing the literal with SPARQL syntax.
* @see #parseLiteral(String, ModelCom)
*/
public static String literalToSparqlSyntax(Literal lit)
{
RDFDatatype litClass = lit.getDatatype();
if (litClass == XSDDatatype.XSDboolean || litClass == XSDDatatype.XSDint || litClass == XSDDatatype.XSDdouble)
{
return lit.getLexicalForm();
}
else return "'" + lit.getLexicalForm() + "'^^<" + lit.getDatatypeURI() + ">";
}
示例4: BooleanLiteralNodeType
import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; //导入方法依赖的package包/类
BooleanLiteralNodeType() {
super("", XSDDatatype.XSDboolean);
}