|
|
@ -1201,59 +1201,4 @@ mod tests { |
|
|
|
assert!(t3.remove(quad).is_err()); // Already locked
|
|
|
|
assert!(t3.remove(quad).is_err()); // Already locked
|
|
|
|
Ok(()) |
|
|
|
Ok(()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
|
|
|
|
fn test_strings_removal() -> Result<()> { |
|
|
|
|
|
|
|
let quad = QuadRef::new( |
|
|
|
|
|
|
|
NamedNodeRef::new_unchecked("http://example.com/s"), |
|
|
|
|
|
|
|
NamedNodeRef::new_unchecked("http://example.com/p"), |
|
|
|
|
|
|
|
NamedNodeRef::new_unchecked("http://example.com/o"), |
|
|
|
|
|
|
|
NamedNodeRef::new_unchecked("http://example.com/g"), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
let quad2 = QuadRef::new( |
|
|
|
|
|
|
|
NamedNodeRef::new_unchecked("http://example.com/s"), |
|
|
|
|
|
|
|
NamedNodeRef::new_unchecked("http://example.com/p"), |
|
|
|
|
|
|
|
NamedNodeRef::new_unchecked("http://example.com/o2"), |
|
|
|
|
|
|
|
NamedNodeRef::new_unchecked("http://example.com/g"), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let storage = Storage::new()?; |
|
|
|
|
|
|
|
let reader = storage.reader(); |
|
|
|
|
|
|
|
let mut writer = storage.transaction(); |
|
|
|
|
|
|
|
writer.insert(quad)?; |
|
|
|
|
|
|
|
writer.insert(quad2)?; |
|
|
|
|
|
|
|
writer.remove(quad2)?; |
|
|
|
|
|
|
|
writer.commit()?; |
|
|
|
|
|
|
|
assert!(reader |
|
|
|
|
|
|
|
.get_str(&StrHash::new("http://example.com/s"))? |
|
|
|
|
|
|
|
.is_some()); |
|
|
|
|
|
|
|
assert!(reader |
|
|
|
|
|
|
|
.get_str(&StrHash::new("http://example.com/p"))? |
|
|
|
|
|
|
|
.is_some()); |
|
|
|
|
|
|
|
assert!(reader |
|
|
|
|
|
|
|
.get_str(&StrHash::new("http://example.com/o2"))? |
|
|
|
|
|
|
|
.is_none()); |
|
|
|
|
|
|
|
let mut writer = storage.transaction(); |
|
|
|
|
|
|
|
writer.clear_graph(NamedNodeRef::new_unchecked("http://example.com/g").into())?; |
|
|
|
|
|
|
|
writer.commit()?; |
|
|
|
|
|
|
|
assert!(reader |
|
|
|
|
|
|
|
.get_str(&StrHash::new("http://example.com/s"))? |
|
|
|
|
|
|
|
.is_none()); |
|
|
|
|
|
|
|
assert!(reader |
|
|
|
|
|
|
|
.get_str(&StrHash::new("http://example.com/p"))? |
|
|
|
|
|
|
|
.is_none()); |
|
|
|
|
|
|
|
assert!(reader |
|
|
|
|
|
|
|
.get_str(&StrHash::new("http://example.com/o"))? |
|
|
|
|
|
|
|
.is_none()); |
|
|
|
|
|
|
|
assert!(reader |
|
|
|
|
|
|
|
.get_str(&StrHash::new("http://example.com/g"))? |
|
|
|
|
|
|
|
.is_some()); |
|
|
|
|
|
|
|
let mut writer = storage.transaction(); |
|
|
|
|
|
|
|
writer.remove_named_graph(NamedNodeRef::new_unchecked("http://example.com/g").into())?; |
|
|
|
|
|
|
|
writer.commit()?; |
|
|
|
|
|
|
|
assert!(reader |
|
|
|
|
|
|
|
.get_str(&StrHash::new("http://example.com/g"))? |
|
|
|
|
|
|
|
.is_none()); |
|
|
|
|
|
|
|
Ok(()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|