GeneralJSONRDF extends GeneralJSON { @Override public void fromUSMF(USMFStatus status) { prepareModel(); ParameterizedSparqlString pss = PQUtils.constructPQ(queryCache(INSERT_ITEM_QUERY_FILE), m); this.eventIRI = m.createResource(generateSocialEventIRI(status)); PQUtils.setPSSResource(pss, Variables.SOCIAL_EVENT.name, eventIRI); PQUtils.setPSSLiteral(pss, Variables.SERVICE.name, status.service); addUserParameters(pss, status.user, status); PQUtils.setPSSLiteral(pss, Variables.SOURCE_URL.name, status.source); PQUtils.setPSSLiteral(pss, Variables.TEXT.name, status.text); PQUtils.setPSSLiteral(pss, Variables.DESC.name, status.description); PQUtils.setPSSLiteral(pss, Variables.CAT.name, status.category); PQUtils.setPSSLiteral(pss, Variables.FAV.name, status.favorites); UpdateAction.execute(pss.asUpdate(), m); pss = PQUtils.constructPQ(readQuery(TOUSERS_INSERT_QUERY_FILE), m); for (final User key : status.to_users) { PQUtils.setPSSResource(pss, Variables.SOCIAL_EVENT.name, eventIRI); addUserParameters(pss, key, status); UpdateAction.execute(pss.asUpdate(), m); pss.clearParams(); } pss = PQUtils.constructPQ(readQuery(LINK_INSERT_QUERY_FILE), m); PQUtils.setPSSResource(pss, Variables.SOCIAL_EVENT.name, eventIRI); for (final Link link : status.links) { PQUtils.setPSSLiteral(pss, Variables.LINK.name, link.href); UpdateAction.execute(pss.asUpdate(), m); } pss = PQUtils.constructPQ(readQuery(KEYWORDS_INSERT_QUERY_FILE), m); PQUtils.setPSSResource(pss, Variables.SOCIAL_EVENT.name, eventIRI); for (final String key : status.keywords) { PQUtils.setPSSLiteral(pss, Variables.KEYWORD.name, key); UpdateAction.execute(pss.asUpdate(), m); } cleanupModel(); status.fillAnalysis(this); }  static void registerRDFAnalysisProvider(String analysis, RDFAnalysisProvider analysisProvider); @Override void readASCII(final Scanner in); @Override void fillUSMF(USMFStatus status); @Override void fromUSMF(USMFStatus status); @Override void writeASCIIAnalysis(PrintWriter outputWriter, List<String> selectiveAnalysis, List<String> selectiveStatus); @Override GeneralJSON instanceFromString(String line);  }
@Test public void testFromUSMF() throws Exception { File twitterfile = fileFromeStream(USMFStatus.class.getResourceAsStream("/org/openimaj/twitter/newtweets.json")); FileTwitterStatusList<USMFStatus> status = FileTwitterStatusList.readUSMF(twitterfile, "UTF-8", GeneralJSONTwitter.class); USMFStatus aStatus = null; for (USMFStatus usmfStatus : status) { if (usmfStatus.to_users.size() > 0) { aStatus = usmfStatus; break; } } GeneralJSONRDF rgj = new GeneralJSONRDF(); rgj.fromUSMF(aStatus); }