use of org.openrdf.model.Resource in project vcell by virtualcell.
the class OntologyInfo method writeSuperClasses.
public static void writeSuperClasses(Graph graph, PrintStream out, Resource resource) {
Iterator<Statement> iter = graph.match(resource, RDFS.SUBCLASSOF, null);
Set<Resource> resources = new HashSet<Resource>();
while (iter.hasNext()) {
Value superClassNode = iter.next().getObject();
if (superClassNode instanceof Resource) {
resources.add((Resource) superClassNode);
}
}
if (resources.size() > 0) {
out.println(" Is sub class of: " + resourcesToString(resources));
}
}
use of org.openrdf.model.Resource 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.Resource 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.Resource in project vcell by virtualcell.
the class MIRIAMizer method newRefGroup.
public RefGroup newRefGroup(Graph graph, Resource resource, MIRIAMQualifier qualifier) {
Resource bag = graph.getValueFactory().createBNode();
graph.add(bag, RDF.TYPE, RDF.BAG);
graph.add(resource, qualifier.getProperty(), bag);
RefGroup group = new RefGroup(bag);
return group;
}
use of org.openrdf.model.Resource 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