本文整理匯總了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); }