update to check if uri valid property uri before checking it exists as property
This commit is contained in:
parent
75e09ad3d4
commit
2109c70f87
1 changed files with 9 additions and 2 deletions
|
@ -21,8 +21,14 @@ public class URIUtils {
|
|||
boolean existingURI = false;
|
||||
ontModel.enterCriticalSection(Lock.READ);
|
||||
try {
|
||||
boolean validPropertyURI = true;
|
||||
String localName = uriStr.substring(uriStr.lastIndexOf("/") + 1);
|
||||
//if local name is only numbers, this is not a valid uri for a property
|
||||
if(localName.matches("\\d+")) {
|
||||
validPropertyURI = false;
|
||||
}
|
||||
Resource newURIAsRes = ResourceFactory.createResource(uriStr);
|
||||
Property newURIAsProp = ResourceFactory.createProperty(uriStr);
|
||||
|
||||
StmtIterator closeIt = ontModel.listStatements(
|
||||
newURIAsRes, null, (RDFNode)null);
|
||||
if (closeIt.hasNext()) {
|
||||
|
@ -37,7 +43,8 @@ public class URIUtils {
|
|||
}
|
||||
}
|
||||
//Check for property
|
||||
if (!existingURI) {
|
||||
if (validPropertyURI && !existingURI) {
|
||||
Property newURIAsProp = ResourceFactory.createProperty(uriStr);
|
||||
closeIt = ontModel.listStatements(
|
||||
null, newURIAsProp, (RDFNode)null);
|
||||
if (closeIt.hasNext()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue