*Yes, I did this: ( Here response is a List<DBpediaResource> )*
Model model = ModelFactory.createDefaultModel();
List<String> uriList = new ArrayList<String>();
for( DBpediaResource dbResource : response ) {
String uri = dbResource.getFullUri();
uriList.add(uri);
}
for( String uri : uriList ) {
Resource resource = model.createResource(uri);
StmtIterator stmts = resource.listProperties(RDFS.comment);
while( stmts.hasNext() ) {
Statement stmt = stmts.next();
RDFNode comment = stmt.getObject();
* System.out.println("Comment: " + comment.toString());*
}
}
*But when I try to print the Comment it returns me nothing. Is there
anything wrong?*
2013/11/9 Joshua TAYLOR <[email protected]>
> On Fri, Nov 8, 2013 at 12:23 PM, Luciane Monteiro <[email protected]>
> wrote:
> > Hi!
> >
> > I need to dereference *URIs*, like:
> >
> > http://dbpedia.org/resource/Google
> >
> > and
> >
> > http://dbpedia.org/resource/American_Airlines
> >
> > returned from *Spotlight*, to get their *RDFS:comments* property.
> >
> >
> > Is it something like this? Look:
> >
> > Model model = ModelFactory.createDefaultModel();
> > model.read( "http://dbpedia.org/resource/Google" );
> >
> > But how do I get the property?
>
> When you asked this on the DBpedia mailing list, I did include code in
> my response, in addition to pointing you to the Jena mailing list. As
> Andy Seaborne mentioned, the Model API (particularly the Model and
> Resource interfaces) will help you out here:
>
> Resource google = model.createResource( "
> http://dbpedia.org/resource/Google" );
> StmtIterator stmts = google.listProperties( RDFS.comment );
> while ( stmts.hasNext() ) {
> Statement stmt = stmts.next();
> RDFNode comment = stmt.getObject();
> /* do something with the comment */
> }
>
>
>
> --
> Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
>