本文整理汇总了Java中org.openrdf.model.impl.ValueFactoryImpl.createURI方法的典型用法代码示例。如果您正苦于以下问题:Java ValueFactoryImpl.createURI方法的具体用法?Java ValueFactoryImpl.createURI怎么用?Java ValueFactoryImpl.createURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.model.impl.ValueFactoryImpl
的用法示例。
在下文中一共展示了ValueFactoryImpl.createURI方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ValueOfMarshall
import org.openrdf.model.impl.ValueFactoryImpl; //导入方法依赖的package包/类
public ValueOfMarshall(ValueFactory vf, Class<T> type)
throws NoSuchMethodException {
this.vf = vf;
ValueFactoryImpl uf = ValueFactoryImpl.getInstance();
this.datatype = uf.createURI("java:", type.getName());
try {
this.valueOfMethod = type.getDeclaredMethod("valueOf",
new Class[] { String.class });
if (!Modifier.isStatic(valueOfMethod.getModifiers()))
throw new NoSuchMethodException("valueOf Method is not static");
if (!type.equals(valueOfMethod.getReturnType()))
throw new NoSuchMethodException("Invalid return type");
} catch (NoSuchMethodException e) {
try {
this.valueOfMethod = type.getDeclaredMethod("getInstance",
new Class[] { String.class });
if (!Modifier.isStatic(valueOfMethod.getModifiers()))
throw new NoSuchMethodException(
"getInstance Method is not static");
if (!type.equals(valueOfMethod.getReturnType()))
throw new NoSuchMethodException("Invalid return type");
} catch (NoSuchMethodException e2) {
throw e;
}
}
}
示例2: readFields
import org.openrdf.model.impl.ValueFactoryImpl; //导入方法依赖的package包/类
@Override
public void readFields(DataInput dataInput) throws IOException {
ValueFactoryImpl vfi = new ValueFactoryImpl();
String data = dataInput.readLine();
String dataTypeString = dataInput.readLine();
URI dataType = vfi.createURI(dataTypeString);
ryatype.setData(data);
ryatype.setDataType(dataType);
}
示例3: entitiesFor
import org.openrdf.model.impl.ValueFactoryImpl; //导入方法依赖的package包/类
private List<Entity> entitiesFor(String identifier) {
ValueFactoryImpl vf = ValueFactoryImpl.getInstance();
Collection<Statement> statements = asList(
vf.createStatement(
vf.createURI("http://" + identifier),
vf.createURI("http://predicate/a"),
vf.createLiteral("object value a")
),
vf.createStatement(
vf.createURI("http://" + identifier),
vf.createURI("http://predicate/b"),
vf.createLiteral("object value b")
),
vf.createStatement(
vf.createURI("http://" + identifier),
vf.createURI("http://predicate/c"),
vf.createLiteral("object value c")
)
);
Resource[] graphs = new Resource[]{vf.createURI("http://foo/graph/" + identifier)};
Entity entity = new Entity(statements, graphs);
Collection<Statement> graphStatements = asList(
vf.createStatement(
vf.createURI("http://foo/graph/" + identifier),
vf.createURI("http://graph/timestamp"),
vf.createLiteral(System.currentTimeMillis())
),
vf.createStatement(
vf.createURI("http://foo/graph/" + identifier),
vf.createURI("http://graph/version"),
vf.createLiteral("the graph version")
)
);
Resource[] graphContext = new Resource[]{vf.createURI("http://graph/meta")};
Entity entity1 = new Entity(graphStatements, graphContext);
return asList(entity, entity1);
}