* @param url URL of the SIOC data to be saved.
* The HTTP repsponse for that url contains all information about that sioc data saved in the RDF type.
*/
public void bookmarkSiocData(String siocDataUri, String url) {
Model tempModel = null;
try
{
//get the rdf response for that url
StringBuilder sb = new StringBuilder();
getRdfResponse(sb, url);
tempModel = DbFace.getTempModel();
tempModel.readFrom(new StringReader(sb.toString()));
ClosableIterator<Statement> statements = tempModel.findStatements(Variable.ANY, RDF.type, tempModel.createURI(siocDataUri));
List<String> postExludedPredicates = null;
if (siocDataUri.equals(SIOC.Post)) {
//this is the list of predicates which define the post' details, that isn't needed in the bookmarks
postExludedPredicates = new ArrayList<String>();
postExludedPredicates.add(SIOC.contentEncoded);
postExludedPredicates.add(SIOC.postedBy);
}
/* get the first statement (parhaps there is only one at all) and get more information about it -
* get more information on desired sioc data */
while(statements.hasNext()) {
Statement stmt = statements.next();
//in case od sioc:post there are a lot of information, some of which can be ommited in bookmarks
if (siocDataUri.equals(SIOC.Post)) {
/* For each piece of information about the post, scheck wheter it is unneeded.
* If so, remove it from the graph containing the details. */
ClosableIterator<Statement> ss = tempModel.findStatements(stmt.getSubject(), null, null);
while (ss.hasNext()) {
Statement s = ss.next();
if(postExludedPredicates!=null)
for (String exclPred : postExludedPredicates) {
if (exclPred.equals(s.getPredicate().toString())) {
tempModel.removeStatement(s);
}
}
}
ss.close();
}
// for bookmarks engine issue, add the information
// that current sioc data isIn one's sioc data directory in his/her private bookshelf
tempModel.addStatement(stmt.getSubject(), tempModel.createURI(S3B_SSCF.isIn), tempModel.createURI(ownerSiocDirUri));
break;
}
//it was removed
/*siocDataGraph.remove(tmpRepository.performGraphQuery(