gpt4 book ai didi

com.hp.hpl.jena.datatypes.xsd.XSDDatatype类的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 06:55:05 25 4
gpt4 key购买 nike

本文整理了Java中com.hp.hpl.jena.datatypes.xsd.XSDDatatype类的一些代码示例,展示了XSDDatatype类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSDDatatype类的具体详情如下:
包路径:com.hp.hpl.jena.datatypes.xsd.XSDDatatype
类名称:XSDDatatype

XSDDatatype介绍

[英]Representation of an XSD datatype based on the Xerces-2 XSD implementation.
[中]基于Xerces-2 XSD实现的XSD数据类型的表示。

代码示例

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static NodeValue makeNodeInteger(long v)
{
  NodeValue nv = makeNode(Long.toString(v), null, XSDinteger.getURI()) ;
  return nv ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Test whether the given LiteralLabel is a valid instance
 * of this datatype. This takes into accound typing information
 * as well as lexical form - for example an xsd:string is
 * never considered valid as an xsd:integer (even if it is
 * lexically legal like "1").
 */
@Override
public boolean isValidLiteral(LiteralLabel lit) {
  return isBaseTypeCompatible(lit) && isValid(lit.getLexicalForm());
}

代码示例来源:origin: com.hp.hpl.jena/arq

public static int nodeToInt(Node node)
{
  LiteralLabel lit = node.getLiteral() ;
  
  if ( ! XSDDatatype.XSDinteger.isValidLiteral(lit) )
    return Integer.MIN_VALUE ;
  int i = ((Number)lit.getValue()).intValue() ;
  return i ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

return Integer.valueOf(trimPlus(validatedInfo.normalizedValue));
return suitableInteger( trimPlus(validatedInfo.normalizedValue) );
return Integer.valueOf(trimPlus(validatedInfo.normalizedValue));
  BigDecimal value =  new BigDecimal(trimPlus(validatedInfo.normalizedValue));
  return XSDdecimal.cannonicalise( value );
String lexical = trimPlus(validatedInfo.normalizedValue);
int dotx = lexical.indexOf('.');
if (dotx != -1) {
  return new BigInteger(lexical);
} else {
  return suitableInteger( lexical );
return parseValidated(validatedInfo.normalizedValue);

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

if ( sameValueAsString && XSDstring.isValidLiteral(lit) ) 
  if ( XSDinteger.isValidLiteral(lit) )
if ( datatype.equals(XSDdecimal) && XSDdecimal.isValidLiteral(lit) )
if ( datatype.equals(XSDfloat) && XSDfloat.isValidLiteral(lit) )
if ( datatype.equals(XSDdouble) && XSDdouble.isValidLiteral(lit) )
    XSDdateTime.isValid(lex) ) 
if ( datatype.equals(XSDdate) && XSDdate.isValidLiteral(lit) )
if ( datatype.equals(XSDtime) && XSDtime.isValidLiteral(lit) )
if ( datatype.equals(XSDgYear) && XSDgYear.isValidLiteral(lit) )
if ( datatype.equals(XSDgYearMonth) && XSDgYearMonth.isValidLiteral(lit) )
if ( datatype.equals(XSDgMonth) && XSDgMonth.isValidLiteral(lit) )
if ( datatype.equals(XSDgMonthDay) && XSDgMonthDay.isValidLiteral(lit) )
if ( datatype.equals(XSDgDay) && XSDgDay.isValidLiteral(lit) )
    dtXSDdayTimeDuration.equals(datatypeURI) || 
    dtXSDyearMonthDuration.equals(datatypeURI) ) &&
    XSDduration.isValid(lex) ) // use lex

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Turn a possible numeric token into typed literal else a plain literal
 * @return the constructed literal node
 */
Node parseNumber(String lit) {
  if ( Character.isDigit(lit.charAt(0)) || 
    (lit.charAt(0) == '-' && lit.length() > 1 && Character.isDigit(lit.charAt(1))) ) {
    if (lit.indexOf(".") != -1) {
      // Float?
      if (XSDDatatype.XSDfloat.isValid(lit)) {
        return NodeFactory.createLiteral(lit, "", XSDDatatype.XSDfloat);
      }
    } else {
      // Int?
      if (XSDDatatype.XSDint.isValid(lit)) {
        return NodeFactory.createLiteral(lit, "", XSDDatatype.XSDint);
      }
    }
  }
  // Default is a plain literal
  return NodeFactory.createLiteral(lit, "", false);
}

代码示例来源:origin: DeFacto/DeFacto

evidenceIndividual,
ResourceFactory.createProperty(TIME_PROPERTY_FROM),
ResourceFactory.createTypedLiteral(evidence.defactoTimePeriod.getFrom().toString(), new XSDDatatype("gYear"))));
ResourceFactory.createTypedLiteral(evidence.defactoTimePeriod.getTo().toString(), new XSDDatatype("gYear"))));

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Parse a lexical form of this datatype to a value
 * @throws DatatypeFormatException if the lexical form is not legal
 */
@Override
public Object parse(String lexicalForm) throws DatatypeFormatException {
  try {
    ValidationContext context = new ValidationState();
    ValidatedInfo resultInfo = new ValidatedInfo();
    Object result = typeDeclaration.validate(lexicalForm, context, resultInfo);
    return convertValidatedDataValue(resultInfo);
  } catch (InvalidDatatypeValueException e) {
    throw new DatatypeFormatException(lexicalForm, this, "during parse -" + e);
  }
}

代码示例来源:origin: com.hp.hpl.jena/arq

protected NodeValue cast(String s, NodeValue nv, XSDDatatype castType2)
  {
    // Plain cast.
    if ( ! castType.isValid(s) )
      throw new ExprEvalException("CastXSD: Not a valid literal form: "+s) ;
    // Unfortunately, validity testing happens in NodeValue.makeNode as well.
    return NodeValue.makeNode(s, castType) ;
  }
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

tm.registerDatatype(new XSDDatatype("anySimpleType"));

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static NodeValue makeNodeDecimal(String lexicalForm)
{
  NodeValue nv = makeNode(lexicalForm, null, XSDdecimal.getURI()) ;
  return nv ;
}

代码示例来源:origin: com.hp.hpl.jena/arq

public static long nodeToLong(Node node)
{
  LiteralLabel lit = node.getLiteral() ;
  
  if ( ! XSDDatatype.XSDinteger.isValidLiteral(lit) )
    return Long.MIN_VALUE ;
  long i = ((Number)lit.getValue()).longValue() ;
  return i ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

if ( ! castType.isValid(s) )
  throw new ExprEvalException("CastXSD: Not a valid literal form: '"+s+"'") ;

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

protected void emitLiteralInteger(int beginLine, int beginColumn, String image)
{ 
  emitLiteral(beginLine, beginColumn, image, null, XSDDatatype.XSDinteger.getURI(), null) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static int nodeToInt(Node node)
{
  LiteralLabel lit = node.getLiteral() ;
  
  if ( ! XSDDatatype.XSDinteger.isValidLiteral(lit) )
    return Integer.MIN_VALUE ;
  int i = ((Number)lit.getValue()).intValue() ;
  return i ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static NodeValue makeNodeInteger(String lexicalForm)
{
  NodeValue nv = makeNode(lexicalForm, null, XSDinteger.getURI()) ;
  return nv ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static long nodeToLong(Node node)
{
  LiteralLabel lit = node.getLiteral() ;
  
  if ( ! XSDDatatype.XSDinteger.isValidLiteral(lit) )
    return Long.MIN_VALUE ;
  long i = ((Number)lit.getValue()).longValue() ;
  return i ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static NodeValue makeNodeFloat(String lexicalForm)
{
  NodeValue nv = makeNode(lexicalForm, null, XSDdouble.getURI()) ;
  return nv ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static float nodeToFloat(Node node)
{
  LiteralLabel lit = node.getLiteral();
  
  if ( ! XSDDatatype.XSDfloat.isValidLiteral(lit) )
    return Float.NaN;
  float f = ((Number)lit.getValue()).floatValue();
  return f;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static NodeValue makeNodeDouble(String lexicalForm)
{
  NodeValue nv = makeNode(lexicalForm, null, XSDdouble.getURI()) ;
  return nv ;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com