}
boolean ok = false;
if ( ! result.toLowerCase().startsWith("error:") ) {
EntityInfo entityInfo = new EntityInfo();
String[] lines = result.split("\n|\r\n|\n");
for (String string : lines) {
String[] toks = string.split(",", 2);
if ( toks.length != 2 || ("prop".equals(toks[0]) && "value".equals(toks[1])) ) {
continue;
}
String prop = toks[0];
String value = toks.length > 1 ? toks[1] : null;
Resource propResource = ResourceFactory.createResource(prop);
PropValue pv = new PropValue();
pv.setPropName(propResource.getLocalName());
pv.setPropUri(prop);
boolean valueIsUri = false;
try {
URI jUri = new URI(value); // just check to see whether is a URI
valueIsUri = jUri.isAbsolute();
}
catch (URISyntaxException e) {
// ignore.
}
if ( valueIsUri ) {
pv.setValueUri(value);
Resource objResource = ResourceFactory.createResource(value);
pv.setValueName(objResource.getLocalName());
}
else {
pv.setValueName(value);
}
entityInfo.getProps().add(pv);
}
int size = entityInfo.getProps().size();
if ( size > 0 ) {
ok = true;
entityInfo.setUri(uri);
if ( log.isDebugEnabled() ) {
log.debug("Added " +size+ " property/value pairs to " +uri);
}
resolveUriResult.setEntityInfo(entityInfo);
}