addResourceInstanceToCache(resource, onlAcc);
// Specific Attributes and Properties of Foaf:OnlineAccount Class //
// foafAccountName //
Property foafAccountName = ResourceFactory.createProperty(
foafNamespace + "accountName");
StmtIterator stmtI1 = model.listStatements(resource,
foafAccountName, (RDFNode)null);
while(stmtI1.hasNext()) {
Statement statement = stmtI1.nextStatement();
// validate name property //
if(!statement.getObject().isLiteral()) {
if(!ModelException.throwException(ModelException.ONLINEACCOUNT,
"name property of OnlineAccount resource:"+
resource.getURI()+" is not a literal")) {
return null;
}
} else {
onlAcc.setName(statement.getObject().asLiteral().getString());
}
}
// foafAccountProfilePage //
Property foafAccountProfilePage = ResourceFactory.createProperty(
foafNamespace + "accountProfilePage");
stmtI1 = model.listStatements(resource,
foafAccountProfilePage, (RDFNode)null);
while(stmtI1.hasNext()) {
Statement statement = stmtI1.nextStatement();
// validate name property //
if(!statement.getObject().isLiteral()) {
if(!ModelException.throwException(ModelException.ONLINEACCOUNT,
"name property of OnlineAccount resource:"+
resource.getURI()+" is not a literal")) {
return null;
}
} else {
onlAcc.setUrl(statement.getObject().asLiteral().getString());
}
}
// belongsTo //
Property belongsTo = ResourceFactory.createProperty(
riNamespace + "belongsTo");
stmtI1 = model.listStatements(resource,
belongsTo, (RDFNode)null);
while(stmtI1.hasNext()) {
Statement statement = stmtI1.nextStatement();
// validate belongsTo property //
if(!statement.getObject().isResource()) {
if(!ModelException.throwException(ModelException.ONLINEACCOUNT,
"belongsTo property of resource:"+
resource.getURI()+" is not a resource")) {