|
|
@ -713,19 +713,13 @@ pub fn insert_term<F: FnMut(&StrHash, &str) -> Result<(), StorageError>>( |
|
|
|
if let EncodedTerm::NamedNode { iri_id } = encoded { |
|
|
|
if let EncodedTerm::NamedNode { iri_id } = encoded { |
|
|
|
insert_str(iri_id, node.as_str()) |
|
|
|
insert_str(iri_id, node.as_str()) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Err( |
|
|
|
Err(CorruptionError::from_encoded_term(encoded, &term).into()) |
|
|
|
CorruptionError::new(format!("Invalid term encoding {encoded:?} for {term}")) |
|
|
|
|
|
|
|
.into(), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
TermRef::BlankNode(node) => match encoded { |
|
|
|
TermRef::BlankNode(node) => match encoded { |
|
|
|
EncodedTerm::BigBlankNode { id_id } => insert_str(id_id, node.as_str()), |
|
|
|
EncodedTerm::BigBlankNode { id_id } => insert_str(id_id, node.as_str()), |
|
|
|
EncodedTerm::SmallBlankNode(..) | EncodedTerm::NumericalBlankNode { .. } => Ok(()), |
|
|
|
EncodedTerm::SmallBlankNode(..) | EncodedTerm::NumericalBlankNode { .. } => Ok(()), |
|
|
|
_ => Err( |
|
|
|
_ => Err(CorruptionError::from_encoded_term(encoded, &term).into()), |
|
|
|
CorruptionError::new(format!("Invalid term encoding {encoded:?} for {term}")) |
|
|
|
|
|
|
|
.into(), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
TermRef::Literal(literal) => match encoded { |
|
|
|
TermRef::Literal(literal) => match encoded { |
|
|
|
EncodedTerm::BigStringLiteral { value_id } |
|
|
|
EncodedTerm::BigStringLiteral { value_id } |
|
|
@ -736,10 +730,7 @@ pub fn insert_term<F: FnMut(&StrHash, &str) -> Result<(), StorageError>>( |
|
|
|
if let Some(language) = literal.language() { |
|
|
|
if let Some(language) = literal.language() { |
|
|
|
insert_str(language_id, language) |
|
|
|
insert_str(language_id, language) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Err(CorruptionError::new(format!( |
|
|
|
Err(CorruptionError::from_encoded_term(encoded, &term).into()) |
|
|
|
"Invalid term encoding {encoded:?} for {term}" |
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
.into()) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
EncodedTerm::BigBigLangStringLiteral { |
|
|
|
EncodedTerm::BigBigLangStringLiteral { |
|
|
@ -750,10 +741,7 @@ pub fn insert_term<F: FnMut(&StrHash, &str) -> Result<(), StorageError>>( |
|
|
|
if let Some(language) = literal.language() { |
|
|
|
if let Some(language) = literal.language() { |
|
|
|
insert_str(language_id, language) |
|
|
|
insert_str(language_id, language) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Err(CorruptionError::new(format!( |
|
|
|
Err(CorruptionError::from_encoded_term(encoded, &term).into()) |
|
|
|
"Invalid term encoding {encoded:?} for {term}" |
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
.into()) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
EncodedTerm::SmallTypedLiteral { datatype_id, .. } => { |
|
|
|
EncodedTerm::SmallTypedLiteral { datatype_id, .. } => { |
|
|
@ -784,10 +772,7 @@ pub fn insert_term<F: FnMut(&StrHash, &str) -> Result<(), StorageError>>( |
|
|
|
| EncodedTerm::DurationLiteral(..) |
|
|
|
| EncodedTerm::DurationLiteral(..) |
|
|
|
| EncodedTerm::YearMonthDurationLiteral(..) |
|
|
|
| EncodedTerm::YearMonthDurationLiteral(..) |
|
|
|
| EncodedTerm::DayTimeDurationLiteral(..) => Ok(()), |
|
|
|
| EncodedTerm::DayTimeDurationLiteral(..) => Ok(()), |
|
|
|
_ => Err( |
|
|
|
_ => Err(CorruptionError::from_encoded_term(encoded, &term).into()), |
|
|
|
CorruptionError::new(format!("Invalid term encoding {encoded:?} for {term}")) |
|
|
|
|
|
|
|
.into(), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
TermRef::Triple(triple) => { |
|
|
|
TermRef::Triple(triple) => { |
|
|
|
if let EncodedTerm::Triple(encoded) = encoded { |
|
|
|
if let EncodedTerm::Triple(encoded) = encoded { |
|
|
@ -799,10 +784,7 @@ pub fn insert_term<F: FnMut(&StrHash, &str) -> Result<(), StorageError>>( |
|
|
|
)?; |
|
|
|
)?; |
|
|
|
insert_term(triple.object.as_ref(), &encoded.object, insert_str) |
|
|
|
insert_term(triple.object.as_ref(), &encoded.object, insert_str) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Err( |
|
|
|
Err(CorruptionError::from_encoded_term(encoded, &term).into()) |
|
|
|
CorruptionError::new(format!("Invalid term encoding {encoded:?} for {term}")) |
|
|
|
|
|
|
|
.into(), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|