|
|
@ -183,22 +183,23 @@ impl Verifier { |
|
|
|
// Apply all triples for that subject to the tracked (shape, subject) pair.
|
|
|
|
// Apply all triples for that subject to the tracked (shape, subject) pair.
|
|
|
|
// Record the changes.
|
|
|
|
// Record the changes.
|
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
let orm_subscription = self |
|
|
|
|
|
|
|
.orm_subscriptions |
|
|
|
|
|
|
|
.get_mut(nuri) |
|
|
|
|
|
|
|
.unwrap() |
|
|
|
|
|
|
|
.iter_mut() |
|
|
|
|
|
|
|
.find(|sub| { |
|
|
|
|
|
|
|
sub.shape_type.shape == *root_shape_iri && sub.session_id == session_id |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.unwrap(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update tracked subjects and modify change objects.
|
|
|
|
if !change.data_applied { |
|
|
|
if !change.data_applied { |
|
|
|
log_debug!( |
|
|
|
log_debug!( |
|
|
|
"Adding triples to change tracker for subject {}", |
|
|
|
"Adding triples to change tracker for subject {}", |
|
|
|
subject_iri |
|
|
|
subject_iri |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
let orm_subscription = self |
|
|
|
|
|
|
|
.orm_subscriptions |
|
|
|
|
|
|
|
.get_mut(nuri) |
|
|
|
|
|
|
|
.unwrap() |
|
|
|
|
|
|
|
.iter_mut() |
|
|
|
|
|
|
|
.find(|sub| { |
|
|
|
|
|
|
|
sub.shape_type.shape == shape.iri && sub.session_id == session_id |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.unwrap(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if let Err(e) = add_remove_triples( |
|
|
|
if let Err(e) = add_remove_triples( |
|
|
|
shape.clone(), |
|
|
|
shape.clone(), |
|
|
|
subject_iri, |
|
|
|
subject_iri, |
|
|
@ -211,19 +212,40 @@ impl Verifier { |
|
|
|
panic!(); |
|
|
|
panic!(); |
|
|
|
} |
|
|
|
} |
|
|
|
change.data_applied = true; |
|
|
|
change.data_applied = true; |
|
|
|
} else { |
|
|
|
|
|
|
|
log_debug!("not applying triples again for subject {subject_iri}"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let orm_subscription = self |
|
|
|
// Check if this is the first evaluation round - In that case, set old validity to new one.
|
|
|
|
.orm_subscriptions |
|
|
|
// if the object was already validated, don't do so again.
|
|
|
|
.get_mut(nuri) |
|
|
|
{ |
|
|
|
.unwrap() |
|
|
|
let tracked_subject = &mut orm_subscription |
|
|
|
.iter_mut() |
|
|
|
.tracked_subjects |
|
|
|
.find(|sub| { |
|
|
|
.get(*subject_iri) |
|
|
|
sub.shape_type.shape == shape.iri && sub.session_id == session_id |
|
|
|
.unwrap() |
|
|
|
}) |
|
|
|
.get(&shape.iri) |
|
|
|
.unwrap(); |
|
|
|
.unwrap() |
|
|
|
|
|
|
|
.write() |
|
|
|
|
|
|
|
.unwrap(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// First run
|
|
|
|
|
|
|
|
if !change.data_applied |
|
|
|
|
|
|
|
&& tracked_subject.valid != OrmTrackedSubjectValidity::Pending |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tracked_subject.prev_valid = tracked_subject.valid.clone(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if change.data_applied { |
|
|
|
|
|
|
|
log_debug!("not applying triples again for subject {subject_iri}"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Has this subject already been validated?
|
|
|
|
|
|
|
|
if change.data_applied |
|
|
|
|
|
|
|
&& tracked_subject.valid != OrmTrackedSubjectValidity::Pending |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
log_debug!("Not evaluating subject again {subject_iri}"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Validate the subject.
|
|
|
|
// Validate the subject.
|
|
|
|
let need_eval = Self::update_subject_validity(change, &shape, orm_subscription); |
|
|
|
let need_eval = Self::update_subject_validity(change, &shape, orm_subscription); |
|
|
|