本文整理了Java中org.openrdf.model.Model.add()
方法的一些代码示例,展示了Model.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.add()
方法的具体详情如下:
包路径:org.openrdf.model.Model
类名称:Model
方法名:add
暂无
代码示例来源:origin: stackoverflow.com
Model model = ...
model.addLiteral (subject, predicate, 10);
model.addLiteral (subject, predicate, 0.5);
model.addLiteral (subject, predicate, (float)0.5);
model.addLiteral (subject, predicate, ResourceFactory.createTypedLiteral(20));
model.addLiteral (subject, predicate, ResourceFactory.createTypedLiteral(0.99));
model.addLiteral (subject, predicate, true);
model.add (subject, predicate, ResourceFactory.createTypedLiteral("2012-03-11", XSDDatatype.XSDdate));
model.add (subject, predicate, ResourceFactory.createTypedLiteral("P2Y", XSDDatatype.XSDduration));
代码示例来源:origin: org.openrdf.sesame/sesame-rio-rdfjson
@Override
public void handleStatement(final Statement statement)
throws RDFHandlerException
{
this.graph.add(statement);
}
代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.model.sesame
/**
* Adds a value to a property and handles a possible
* {@link RepositoryException} while doing so
* @param property
* @param value
* @throws IllegalStateException in case of a {@link RepositoryException}
* while adding the value.
*/
private void addValue(URI property, Value value) {
model.add(subject, property, value);
}
代码示例来源:origin: org.openrdf.sesame/sesame-store
@Override
public void handleStatement(Statement st)
throws RDFHandlerException
{
model.add(st);
}
代码示例来源:origin: org.openrdf.sesame/sesame-store
@Override
public void handleStatement(Statement st)
throws RDFHandlerException
{
model.add(st);
}
代码示例来源:origin: org.openrdf.sesame/sesame-model
/**
* @deprecated since 4.0. Use {@link #add(Resource, IRI, Value, Resource...)}
* instead.
*/
@Deprecated
public default boolean add(Resource subj, URI pred, Value obj, Resource... contexts) {
return add(subj, (IRI)pred, obj, contexts);
}
代码示例来源:origin: org.openrdf.sesame/sesame-runtime
private static void addToGraph(Model graph, Resource subject, IRI predicate, Value object) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(subject + " " + predicate + " " + object);
}
graph.add(subject, predicate, object);
}
代码示例来源:origin: org.openrdf.sesame/sesame-sail-inferencer
private void addQueryNode(Model m, Resource implNode, IRI predicate, String queryText) {
if (null != queryText) {
ValueFactory factory = SimpleValueFactory.getInstance();
BNode queryNode = factory.createBNode();
m.add(implNode, predicate, queryNode);
m.add(queryNode, RDF.TYPE, SP.CONSTRUCT_CLASS);
m.add(queryNode, SP.TEXT_PROPERTY, factory.createLiteral(queryText));
}
}
}
代码示例来源:origin: org.apache.marmotta/marmotta-commons
@Override
public void handleStatement(Statement st) throws RDFHandlerException {
for(Predicate<Statement> f : filters) {
if(!f.test(st)) {
return;
}
}
model.add(st);
}
};
代码示例来源:origin: stackoverflow.com
String NS = "http://example.com/test#";
Model m = ModelFactory.createDefaultModel();
Resource r = m.createResource("http://meetup/nyc");
Property p = m.createProperty(NS + "hasData");
m.add(r, p, "somedata");
m.add(r, p, "more data");
m.write(System.out);
代码示例来源:origin: org.openrdf.sesame/sesame-repository-sail
@Override
public Resource export(Model model) {
Resource repImplNode = super.export(model);
if (sailImplConfig != null) {
Resource sailImplNode = sailImplConfig.export(model);
model.add(repImplNode, SAILIMPL, sailImplNode);
}
return repImplNode;
}
代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-object
private void addBaseClass(RDFClass klass) {
if (klass.getRDFClasses(RDFS.SUBCLASSOF).isEmpty()) {
for (String b : baseClasses) {
URI name = new URIImpl(JAVA_NS + b);
model.add(klass.getURI(), RDFS.SUBCLASSOF, name);
}
}
}
代码示例来源:origin: apache/marmotta
private static void addTypeTriple(Resource subject, String type, Model model, ValueFactory valueFactory) throws RepositoryException {
if (type == null) return;
final URI predUri = valueFactory.createURI(Namespaces.NS_RDF + "type");
final URI rdfType = valueFactory.createURI(type);
Statement stmt = valueFactory.createStatement(subject, predUri, rdfType);
model.add(stmt);
}
代码示例来源:origin: org.openrdf.sesame/sesame-repository-sail
@Override
public Resource export(Model model) {
Resource implNode = super.export(model);
if (null != this.proxiedID) {
model.add(implNode, ProxyRepositorySchema.PROXIED_ID,
SimpleValueFactory.getInstance().createLiteral(this.proxiedID));
}
return implNode;
}
代码示例来源:origin: org.apache.marmotta/ldclient-provider-mediawiki
private static void addTriple(Resource subject, String predicate, String object, Model model, ValueFactory valueFactory)
throws RepositoryException {
if (predicate == null || object == null) return;
final URI predUri = valueFactory.createURI(predicate);
final URI objUri = valueFactory.createURI(object);
Statement stmt = valueFactory.createStatement(subject, predUri, objUri);
model.add(stmt);
}
代码示例来源:origin: org.apache.marmotta/ldclient-provider-rdf
@Override
public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException {
Value predicate = bindingSet.getValue("p");
Value object = bindingSet.getValue("o");
if(predicate instanceof URI) {
triples.add(ValueFactoryImpl.getInstance().createStatement(subject,(URI)predicate,object));
} else {
log.error("ignoring binding as predicate {} is not a URI",predicate);
}
}
代码示例来源:origin: stackoverflow.com
final Model m = ModelFactory.createDefaultModel();
final Resource s = m.createResource("urn:ex:subject");
final Property p = m.createProperty("urn:ex:predicate");
final Resource o = m.createResource("urn:ex:object");
m.add(s,p,o);
try( final OutputStream out = Files.newOutputStream(Paths.createTempFile("tmp","rdf"), StandardOpenOptions.CREATE_NEW) ){
m.write(out, null, "RDF/XML");
}
代码示例来源:origin: org.openrdf.sesame/sesame-model-testsuite
@Override
public Set makeEmptySet() {
Model model = makeEmptyModel();
model.add(vf.createStatement(RDF.TYPE, RDF.TYPE, RDF.PROPERTY, createURI("hidden")));
return model.filter(null, null, null, ctx0, ctx1);
}
代码示例来源:origin: org.openrdf.sesame/sesame-rio-testsuite
private final Model getTestModel(String datatypeValue, IRI datatypeURI) {
Model result = new LinkedHashModel();
result.add(vf.createStatement(vf.createBNode(), DC.DESCRIPTION,
vf.createLiteral(datatypeValue, datatypeURI)));
return result;
}
代码示例来源:origin: org.openrdf.sesame/sesame-rio-testsuite
private final Model getTestModel(String languageValue, String languageTag) {
Model result = new LinkedHashModel();
result.add(vf.createStatement(vf.createBNode(), RDFS.COMMENT,
vf.createLiteral(languageValue, languageTag)));
return result;
}
}
内容来源于网络,如有侵权,请联系作者删除!