本文整理匯總了Java中org.apache.jena.rdf.model.Model.getResource方法的典型用法代碼示例。如果您正苦於以下問題:Java Model.getResource方法的具體用法?Java Model.getResource怎麽用?Java Model.getResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.jena.rdf.model.Model
的用法示例。
在下文中一共展示了Model.getResource方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: listNotifications
import org.apache.jena.rdf.model.Model; //導入方法依賴的package包/類
public List<String> listNotifications(String inboxUrl) throws InterruptedException, IOException{
List<String> notifications=new ArrayList<String>();
UrlRequest urlReq=new UrlRequest(inboxUrl, "Accept", "application/ld+json");
FetchRequest fetched = httpFetcher.fetch(urlReq);
if (fetched.getResponseStatusCode()==200) {
if(fetched.getContent().getType().getMimeType().equals("application/ld+json")) {
Model dcModelRdf = ModelFactory.createDefaultModel();
ByteArrayInputStream bytesIs = new ByteArrayInputStream(fetched.getContent().asBytes());
RDFDataMgr.read(dcModelRdf, bytesIs, inboxUrl, Lang.JSONLD);
try {
bytesIs.close();
} catch (IOException e) {
throw new RuntimeException(e.getMessage(), e);
}
Resource resource = dcModelRdf.getResource(inboxUrl);
StmtIterator seeAlsoStms = resource.listProperties(RdfReg.LDN_CONTAINS);
while (seeAlsoStms.hasNext()) {
Statement st = seeAlsoStms.next();
// System.out.println(st);
notifications.add(st.getObject().toString());
}
}
}
return notifications;
}