use of org.openrdf.model.Value in project vcell by virtualcell.
the class OntUtil method createUnion.
public static BNode createUnion(Graph graph, Value... values) {
BNode unionNode = graph.getValueFactory().createBNode();
graph.add(unionNode, RDF.TYPE, OWL.CLASS);
Value listNode = createList(graph, values);
graph.add(unionNode, OWL.UNIONOF, listNode);
return unionNode;
}
use of org.openrdf.model.Value in project vcell by virtualcell.
the class OntUtil method createDataRange.
public static BNode createDataRange(Graph graph, String... strings) {
ArrayList<Value> valueList = new ArrayList<Value>();
for (String string : strings) {
valueList.add(graph.getValueFactory().createLiteral(string));
}
BNode unionNode = graph.getValueFactory().createBNode();
graph.add(unionNode, RDF.TYPE, DATARANGE);
Value listNode = createList(graph, valueList.toArray(new Value[0]));
graph.add(unionNode, OWL.ONEOF, listNode);
return unionNode;
}
use of org.openrdf.model.Value in project vcell by virtualcell.
the class OntSpecUtil method findMissingComment.
public static Set<Resource> findMissingComment(Graph schema) {
Set<Resource> resources = new HashSet<Resource>();
for (Statement statement : schema) {
Resource subject = statement.getSubject();
if (isMissingComment(schema, subject)) {
resources.add(subject);
}
URI predicate = statement.getPredicate();
if (isMissingComment(schema, predicate)) {
resources.add(predicate);
}
;
Value object = statement.getObject();
if (isMissingComment(schema, object)) {
resources.add((Resource) object);
}
}
return resources;
}
use of org.openrdf.model.Value in project vcell by virtualcell.
the class Model2JDOM method addModel.
public void addModel(Graph model, String baseURI) {
for (Statement statement : model) {
Resource subject = statement.getSubject();
Element elementS = addSubjectElement(model, subject, root);
URI predicate = statement.getPredicate();
Element elementP = createPredicateElement(predicate);
Value object = statement.getObject();
if (object instanceof Resource) {
Resource objectR = (Resource) object;
if (!isTypeSetAsName(elementS, subject, predicate, object)) {
elementS.addContent(elementP);
addObjectElement(model, objectR, elementP);
}
} else {
elementS.addContent(elementP);
Literal objectL = (Literal) object;
elementP.addContent(new Text(objectL.stringValue()));
URI dataTypeURI = objectL.getDatatype();
if (dataTypeURI != null) {
elementP.setAttribute("datatype", dataTypeURI.stringValue(), nsRDF);
}
String languageTag = objectL.getLanguage();
if (languageTag != null) {
elementP.setAttribute("lang", languageTag, Namespace.XML_NAMESPACE);
}
}
}
}
use of org.openrdf.model.Value in project vcell by virtualcell.
the class MIRIAMizer method getRefGroups.
public Set<RefGroup> getRefGroups(Graph graph, Resource resource, MIRIAMQualifier qualifier) {
Set<RefGroup> groups = new HashSet<RefGroup>();
Iterator<Statement> iter = graph.match(resource, qualifier.getProperty(), null);
while (iter.hasNext()) {
Statement statement = iter.next();
Value node = statement.getObject();
if (node instanceof Resource) {
groups.add(new RefGroup((Resource) node));
}
}
return groups;
}
Aggregations