use of org.openrdf.model.Value in project vcell by virtualcell.
the class IndexedGraph method addToAllMaps.
protected void addToAllMaps(Statement statement) {
Resource subject = statement.getSubject();
URI predicate = statement.getPredicate();
Value object = statement.getObject();
addToMap(sMap, subject, statement);
addToMap(pMap, predicate, statement);
addToMap(oMap, object, statement);
addToMap(spMap, new ListOfTwo<Value>(subject, predicate), statement);
addToMap(soMap, new ListOfTwo<Value>(subject, object), statement);
addToMap(poMap, new ListOfTwo<Value>(predicate, object), statement);
}
use of org.openrdf.model.Value in project vcell by virtualcell.
the class OntologyInfo method resourcesFromStatement.
public static Set<Resource> resourcesFromStatement(Statement statement) {
Resource subject = statement.getSubject();
URI predicate = statement.getPredicate();
Value object = statement.getObject();
if (object instanceof Resource) {
return new SetOfThree<Resource>(subject, predicate, (Resource) object);
} else {
return new SetOfTwo<Resource>(subject, predicate);
}
}
use of org.openrdf.model.Value in project vcell by virtualcell.
the class OntUtil method createDataRange.
public static BNode createDataRange(Graph graph, Value... values) {
BNode unionNode = graph.getValueFactory().createBNode();
graph.add(unionNode, RDF.TYPE, DATARANGE);
Value listNode = createList(graph, values);
graph.add(unionNode, OWL.ONEOF, listNode);
return unionNode;
}
use of org.openrdf.model.Value in project vcell by virtualcell.
the class OntUtil method createList.
public static Value createList(Graph graph, int offset, Value... values) {
if (offset < values.length) {
BNode listNode = graph.getValueFactory().createBNode();
graph.add(listNode, RDF.FIRST, values[offset]);
Value restNode = createList(graph, offset + 1, values);
graph.add(listNode, RDF.REST, restNode);
return listNode;
} else {
return RDF.NIL;
}
}
use of org.openrdf.model.Value in project blueprints by tinkerpop.
the class SailGraph method addEdge.
public Edge addEdge(final Object id, final Vertex outVertex, final Vertex inVertex, final String label) {
if (label == null)
throw ExceptionFactory.edgeLabelCanNotBeNull();
Value outVertexValue = ((SailVertex) outVertex).getRawVertex();
Value inVertexValue = ((SailVertex) inVertex).getRawVertex();
if (!(outVertexValue instanceof Resource)) {
throw new IllegalArgumentException(outVertex.toString() + " is not a legal URI or blank node");
}
try {
URI labelURI = new URIImpl(this.expandPrefix(label));
Statement statement = new StatementImpl((Resource) outVertexValue, labelURI, inVertexValue);
SailHelper.addStatement(statement, this.sailConnection.get());
return new SailEdge(statement, this);
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
}
Aggregations