use of org.openrdf.model.Resource in project vcell by virtualcell.
the class VCMetaDataMiriamManager method setPrettyName.
public void setPrettyName(MiriamResource miriamResource, String prettyName) {
ValueFactory valueFactory = vcMetaData.getRdfData().getValueFactory();
Resource resource = valueFactory.createURI(miriamResource.getMiriamURN());
Literal prettyNameLiteral = valueFactory.createLiteral(prettyName);
vcMetaData.getRdfData().add(resource, ProtegeDC.description, prettyNameLiteral);
}
use of org.openrdf.model.Resource in project vcell by virtualcell.
the class VCMetaDataMiriamManager method getDublinCoreDateMap.
// this is not yet cached.
public Map<Identifiable, Map<DateQualifier, Set<DublinCoreDate>>> getDublinCoreDateMap() {
Map<Identifiable, Map<DateQualifier, Set<DublinCoreDate>>> map = new HashMap<Identifiable, Map<DateQualifier, Set<DublinCoreDate>>>();
Set<Entry> allEntries = vcMetaData.getRegistry().getAllEntries();
Graph rdfData = vcMetaData.getRdfData();
for (Entry entry : allEntries) {
Resource resource = entry.getResource();
if (resource != null) {
Identifiable identifiable = entry.getIdentifiable();
Map<DateQualifier, Set<DublinCoreDate>> qualifierDateMap = new HashMap<DateQualifier, Set<DublinCoreDate>>();
for (DublinCoreQualifier.DateQualifier dateQualifier : AnnotationQualifiers.DC_date_all) {
Set<DublinCoreDate> dateStrings = new HashSet<DublinCoreDate>();
Iterator<Statement> stmtIter = rdfData.match(resource, dateQualifier.getProperty(), null);
while (stmtIter.hasNext()) {
Statement statement = stmtIter.next();
Value dateObject = statement.getObject();
if (dateObject instanceof Literal) {
Literal dateLiteral = (Literal) dateObject;
String dateString = dateLiteral.stringValue();
dateStrings.add(new DublinCoreDate(dateString));
}
}
if (!dateStrings.isEmpty()) {
qualifierDateMap.put(dateQualifier, dateStrings);
}
}
if (!qualifierDateMap.isEmpty()) {
map.put(identifiable, qualifierDateMap);
}
}
}
return map;
}
use of org.openrdf.model.Resource in project vcell by virtualcell.
the class Registry method compareEquals.
public boolean compareEquals(Registry other) {
Set<Resource> resSet = resourceToEntry.keySet();
Set<Resource> otherResSet = other.resourceToEntry.keySet();
if (!resSet.equals(otherResSet)) {
return false;
}
for (Resource res : resSet) {
Entry oe = resourceToEntry.get(res);
Entry otherOe = other.resourceToEntry.get(res);
final VCID vcid = identifiableProvider.getVCID(oe.getIdentifiable());
final VCID otherVcid = other.identifiableProvider.getVCID(otherOe.getIdentifiable());
if (!vcid.toASCIIString().equals(otherVcid.toASCIIString())) {
return false;
}
}
return true;
}
use of org.openrdf.model.Resource in project vcell by virtualcell.
the class OntologyInfo method writeHasObjectProperty.
public static void writeHasObjectProperty(Graph graph, PrintStream out, Resource resource, URI property, String intro) {
Iterator<Statement> iter = graph.match(resource, property, 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(" " + intro + ": " + resourcesToString(resources));
}
}
use of org.openrdf.model.Resource in project vcell by virtualcell.
the class OntologyInfo method resourcesToString.
public static String resourcesToString(Set<Resource> resources) {
String string = "";
boolean isFirst = true;
for (Resource resource : resources) {
if (resource instanceof URI) {
URI uri = (URI) resource;
String localName = uri.getLocalName();
if (localName != null && localName != "") {
if (isFirst) {
string = localName;
isFirst = false;
} else {
string = string + ", " + localName;
}
}
}
}
return string;
}
Aggregations