Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1411 #768

Closed
wants to merge 3 commits into from
Closed

1411 #768

wants to merge 3 commits into from

Conversation

osmandin
Copy link
Contributor

DO NOT MERGE. Just for testing. Please ignore style issues.

while (stmtIterator.hasNext()) {
final Statement s = stmtIterator.next();
final Resource subject = s.getSubject();
if (!subject.toString().contains(getPath())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is badly wrong.

  • It is comparing a JCR value (the result of getPath()) with an RDF value (subject.toString()). That kind of comparison must be mediated by an IdentifierConverter. Use something more like equals(idTranslator.convert(subject)), catching exceptions, or pass in the request URI and do a comparison to that.
  • It does not account for blank nodes.
  • It does not account for hash-URIs

@osmandin osmandin closed this Apr 14, 2015
@@ -465,10 +467,23 @@ public Boolean isNew() {
public void replaceProperties(final IdentifierConverter<Resource, FedoraResource> idTranslator,
final Model inputModel, final RdfStream originalTriples) throws MalformedRdfException {

LOGGER.info("Resource path: {}", getPath());

final StmtIterator stmtIterator = inputModel.listStatements();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are going to use a loop here at all, use listSubjects() instead. It might be better to use Model.query(Selector s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants