String propName = null, propUri = null;
String valueName = null, valueUri = null;
while ( varNames.hasNext() ) {
String varName = varNames.next().toString();
RDFNode rdfNode = sol.get(varName);
if ( rdfNode.isAnon() ) {
continue;
}
if ( varName.equals("prop") ) {
if ( rdfNode.isResource() ) {
Resource r = (Resource) rdfNode;
propName = r.getLocalName();
propUri = r.getURI();
}
else {
propName = rdfNode.toString();
// if propName looks like a URL, associate the link also:
try {
new URL(propName);
propUri = propName;
}
catch (MalformedURLException ignore) {
}
}
}
else if ( varName.equals("value") ) {
if ( rdfNode.isResource() ) {
Resource r = (Resource) rdfNode;
valueName = r.getLocalName();
valueUri = r.getURI();
}
else {
valueName = rdfNode.toString();
// if valueName looks like a URL, associate the link also:
try {
new URL(valueName);
valueUri = valueName;
}