try {
RepositoryConnection con = repos.getConnection();
try {
TupleQuery query = con.prepareTupleQuery(QueryLanguage.SPARQL,CLASSES_QUERY_P1 + uri + CLASSES_QUERY_P2);
TupleQueryResult res = query.evaluate();
Set<String> seen = new HashSet<String>();
while (res.hasNext()) {
BindingSet solution = res.next();
String clazzURI = solution.getValue("resource").stringValue();
if (seen.contains(clazzURI)) {
continue;
}
seen.add(clazzURI);
String label = getFirstNotNull(new Value[] {
solution.getValue("en_label"),
solution.getValue("label") });
String description = getFirstNotNull(new Value[] {
solution.getValue("en_definition"),
solution.getValue("definition"),
solution.getValue("en_description"),
solution.getValue("description") });
RDFSClass clazz = new RDFSClass(clazzURI, label,
description, name, uri);
classes.add(clazz);
}
query = con.prepareTupleQuery(QueryLanguage.SPARQL,PROPERTIES_QUERY_P1 + uri + PROPERTIES_QUERY_P2);
res = query.evaluate();
seen = new HashSet<String>();
while (res.hasNext()) {
BindingSet solution = res.next();
String propertyUri = solution.getValue("resource").stringValue();
if (seen.contains(propertyUri)) {
continue;
}
seen.add(propertyUri);