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


Java XSDDatatype.XSDdouble方法代码示例

本文整理汇总了Java中com.hp.hpl.jena.datatypes.xsd.XSDDatatype.XSDdouble方法的典型用法代码示例。如果您正苦于以下问题:Java XSDDatatype.XSDdouble方法的具体用法?Java XSDDatatype.XSDdouble怎么用?Java XSDDatatype.XSDdouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.hpl.jena.datatypes.xsd.XSDDatatype的用法示例。


在下文中一共展示了XSDDatatype.XSDdouble方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createObservations

import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; //导入方法依赖的package包/类
private void createObservations(List<Property> headers, Resource ds) {
    HashMap<Integer, HashMap<String, Resource>> entities = createEntities();
    String obsPrefix = localNS.DATASET + "-" + id + "/" + localNS.OBS_NAME + "-";

    for (Row row : table.getRows()) {
        Resource obs = model.createResource(obsPrefix + UUID.randomUUID()).addProperty(RDF.type, QB.OBSERVATION);
        obs.addProperty(QB.DATASET_PROPERTY, ds);

        for (int i = 0; i < row.getCells().size(); i++) {
            Cell cell = row.getCells().get(i);

            if (i < getMeasureCount()) {
                // TODO use more data types
                XSDDatatype xsdDatatype = XSDDatatype.XSDdouble;
                Literal literal = model.createTypedLiteral(cell.getValue().getValue(), xsdDatatype);
                obs.addProperty(headers.get(i), literal);
            } else {
                Resource entity = entities.get(i).get(cell.getValue().getValue());
                obs.addProperty(headers.get(i), entity);
            }
        }
    }
}
 
开发者ID:bayerls,项目名称:statistics2cubes,代码行数:24,代码来源:Table2CubeConverter.java

示例2: 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();
}
 
开发者ID:severin-lemaignan,项目名称:oro-server,代码行数:32,代码来源:Namespaces.java

示例3: getNumericType

import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; //导入方法依赖的package包/类
public static RDFDatatype getNumericType(RDFDatatype lhs, RDFDatatype rhs)
{
	int lhsType = getNumericType(lhs);
	int rhsType = getNumericType(rhs);
	
	if (lhsType == XSConstants.INTEGER_DT) {
		if (rhsType == XSConstants.INTEGER_DT)
			return XSDDatatype.XSDinteger;
		if (rhsType == XSConstants.DECIMAL_DT)
			return XSDDatatype.XSDdecimal;
		if (rhsType == XSConstants.FLOAT_DT)
			return XSDDatatype.XSDfloat;
		
		return XSDDatatype.XSDdouble;
	} else if (lhsType == XSConstants.DECIMAL_DT) {
		if (rhsType == XSConstants.INTEGER_DT || rhsType == XSConstants.DECIMAL_DT)
			return XSDDatatype.XSDdecimal;
		if (rhsType == XSConstants.FLOAT_DT)
			return XSDDatatype.XSDfloat;
		
		return XSDDatatype.XSDdouble;
	} else if (lhsType == XSConstants.FLOAT_DT) {
		if (rhsType == XSConstants.INTEGER_DT || rhsType == XSConstants.DECIMAL_DT || rhsType == XSConstants.FLOAT_DT)
			return XSDDatatype.XSDfloat;
		
		return XSDDatatype.XSDdouble;
	} else if (lhsType == XSConstants.DOUBLE_DT) {
		return XSDDatatype.XSDdouble;
	}
	
	throw new IllegalArgumentException();
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:33,代码来源:XSD.java

示例4: 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;
}
 
开发者ID:paulhoule,项目名称:telepath,代码行数:34,代码来源:MaterializationService.java

示例5: 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() + ">";		
}
 
开发者ID:severin-lemaignan,项目名称:oro-server,代码行数:18,代码来源:Helpers.java


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