本文整理汇总了Java中com.hp.hpl.jena.graph.Node.createURI方法的典型用法代码示例。如果您正苦于以下问题:Java Node.createURI方法的具体用法?Java Node.createURI怎么用?Java Node.createURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.graph.Node
的用法示例。
在下文中一共展示了Node.createURI方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: creatRDF
import com.hp.hpl.jena.graph.Node; //导入方法依赖的package包/类
private static void creatRDF(String[] line) {
String s = line[0];
String p = line[1];
String o = line[2];
Node nodeS = Node.createURI(s);
Node nodeP = Node.createURI("<" + p + ">");
Node nodeO = null;
if (o.contains("http")) {
nodeO = Node.createURI("<" + o + ">");
} else if (o.contains(".")) {
//double
NodeFactoryExtra c = new NodeFactoryExtra();
nodeO = c.doubleToNode(Double.parseDouble(o));
} else {
nodeO = Node.createLiteral(o);
}
Triple triple = Triple.create(nodeS, nodeS, nodeS);
//Statement sta = ResourceFactory.createStatement(s, p, o);
graph.add(triple);
}
示例2: testWithPrefix
import com.hp.hpl.jena.graph.Node; //导入方法依赖的package包/类
public void testWithPrefix() {
RelationName original = new RelationName(null, "original");
RelationName alias = new RelationName(null, "alias");
AliasMap aliases = AliasMap.create1(original, alias);
Set<ProjectionSpec> projections = new HashSet<ProjectionSpec>(Arrays.asList(new Attribute[]{
new Attribute(original, "id"),
new Attribute(alias, "value")}));
Relation rel = new RelationImpl(
null, aliases, Expression.TRUE, Expression.TRUE,
Collections.<Join>emptySet(), projections, false, OrderSpec.NONE, Relation.NO_LIMIT, Relation.NO_LIMIT);
TripleRelation t = new TripleRelation(rel,
new TypedNodeMaker(TypedNodeMaker.URI, new Pattern("http://example.org/original/@@[email protected]@"), true),
new FixedNodeMaker(Node.createURI("http://example.org/property"), false),
new TypedNodeMaker(TypedNodeMaker.PLAIN_LITERAL, new Column(new Attribute(alias, "value")), false));
assertEquals("URI(Pattern(http://example.org/original/@@[email protected]@))",
t.nodeMaker(TripleRelation.SUBJECT).toString());
assertEquals("Literal(Column(alias.value))",
t.nodeMaker(TripleRelation.OBJECT).toString());
assertEquals("AliasMap(original AS alias)",
t.baseRelation().aliases().toString());
NodeRelation t4 = t.withPrefix(4);
assertEquals("URI(Pattern(http://example.org/original/@@[email protected]@))",
t4.nodeMaker(TripleRelation.SUBJECT).toString());
assertEquals("Literal(Column(T4_alias.value))",
t4.nodeMaker(TripleRelation.OBJECT).toString());
assertEquals("AliasMap(original AS T4_alias, original AS T4_original)",
t4.baseRelation().aliases().toString());
}
示例3: makeNode
import com.hp.hpl.jena.graph.Node; //导入方法依赖的package包/类
public Node makeNode(String value) { return Node.createURI(value); }