Is there any possibility in Sesame to check if a Predicate (URI), is w3c standard predicate(RDFS predicates for example) like RDF.TYPE or is included in RDF vocabulary?
Asked
Active
Viewed 94 times
1 Answers
2
You can just compare the namespace part of the IRI to the vocabulary namespace, like so:
IRI predicate = ... ; // predicate you want to check
switch (predicate.getNamespace()) {
case RDF.NAMESPACE:
// it's an RDF predicate
break;
case RDFS.NAMESPACE:
// it's an RDFS predicate
break;
... etc
}
Of course this won't tell you if the predicate actually exists as part of the RDF/RDFS vocabulary - it merely tells you that its namespace part corresponds. So if your predicate is some made-up property, e.g. http://www.w3.org/1999/02/22-rdf-syntax-ns#foobar
, it will also conclude it's part of the RDF namespace: it doesn't verify if the foobar
property actually exists in that namespace.
Check the API Javadoc for a complete overview of all property constants in the RDF and RDFS vocabularies.

Jeen Broekstra
- 21,642
- 4
- 51
- 73