Skip to content

Commit

Permalink
Invalid subjects and properties are not variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenVerborgh committed May 1, 2014
1 parent 235eead commit be14c87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/org/linkeddatafragments/servlet/BasicLdfServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private int parseAsInteger(String value) {
*/
private Resource parseAsResource(String value) {
final RDFNode subject = parseAsNode(value);
return subject instanceof Resource ? (Resource)subject : null;
return subject == null || subject instanceof Resource ? (Resource)subject : INVALID_URI;
}

/**
Expand All @@ -178,11 +178,9 @@ private Property parseAsProperty(String value) {
final RDFNode predicateNode = parseAsNode(value);
if (predicateNode instanceof Resource) {
try { return ResourceFactory.createProperty(((Resource)predicateNode).getURI()); }
catch (InvalidPropertyURIException ex) {
return ResourceFactory.createProperty("urn:invalid-predicate-uri");
}
catch (InvalidPropertyURIException ex) { return INVALID_URI; }
}
return null;
return predicateNode == null ? null : INVALID_URI;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/org/linkeddatafragments/util/CommonResources.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class CommonResources {
public final static Property HYDRA_NEXTPAGE = createProperty(HYDRA + "nextPage");
public final static Property HYDRA_PREVIOUSPAGE = createProperty(HYDRA + "previousPage");

public final static Property INVALID_URI = createProperty("urn:invalid");

private final static Property createProperty(String uri) {
return ResourceFactory.createProperty(uri);
}
Expand Down

0 comments on commit be14c87

Please sign in to comment.