user2057437
user2057437

Reputation: 81

How to create a method to get resources of a certain type with Jena?

I have very little knowledge about Jena. How should I create a method to get resources of a specific type?

public static String[] getResourcesOfType(String typeName)
{
  ...
}

Upvotes: 2

Views: 867

Answers (1)

AndyS
AndyS

Reputation: 16630

SELECT * { ?x a <typeURI> }

where "a" is the short form of rdf:type.

Or use

model.listStatements(null, RDF.type, <ResourceForTheType>)

Upvotes: 3

Related Questions