本文整理汇总了Java中com.hp.hpl.jena.datatypes.xsd.XSDDatatype.XSDstring方法的典型用法代码示例。如果您正苦于以下问题:Java XSDDatatype.XSDstring方法的具体用法?Java XSDDatatype.XSDstring怎么用?Java XSDDatatype.XSDstring使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.datatypes.xsd.XSDDatatype
的用法示例。
在下文中一共展示了XSDDatatype.XSDstring方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEntities
import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; //导入方法依赖的package包/类
private HashMap<Integer, HashMap<String, Resource>> createEntities() {
HashMap<Integer, HashMap<String, Resource>> entities = new HashMap<>();
// generate entity map for every dimension column
for (int i = getMeasureCount(); i < table.getRows().get(0).getCells().size(); i++) {
entities.put(i, new HashMap<>());
}
for (int i = getMeasureCount(); i < table.getRows().get(0).getCells().size(); i++) {
HashMap<String, Resource> dimEntities = entities.get(i);
for (int y = 0; y < table.getRows().size(); y++) {
Cell cell = table.getRows().get(y).getCells().get(i);
String id = UUID.randomUUID().toString();
if (!dimEntities.keySet().contains(cell.getValue().getValue())) {
Resource res = model.createResource(localNS.ENTITY + "_" + id);
// TODO use more data types
XSDDatatype xsdDatatype = XSDDatatype.XSDstring;
Literal literal = model.createTypedLiteral(cell.getValue().getValue(), xsdDatatype);
res.addLiteral(RDFS.label, literal);
res.addProperty(RDFS.isDefinedBy, model.createResource(cell.getValue().getUrl()));
res.addProperty(RDF.type, localNS.ENTITY);
dimEntities.put(cell.getValue().getValue(), res);
}
}
}
return entities;
}
示例2: getString
import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; //导入方法依赖的package包/类
/**
Answer the plain string object of the statement <code>s</code>. If the
object is not a string literal, throw a BadObjectException with that statement.
*/
public static String getString( Statement s )
{
RDFNode ob = s.getObject();
if (ob.isResource()) throw new BadObjectException( s );
Literal L = (Literal) ob;
if (!L.getLanguage().equals( "" )) throw new BadObjectException( s );
if (L.getDatatype() == null) return L.getLexicalForm();
if (L.getDatatype() == XSDDatatype.XSDstring) return L.getLexicalForm();
throw new BadObjectException( s );
}
示例3: 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;
}