This commit is contained in:
Alex Wied
2026-07-08 21:07:52 -04:00
parent eff98162cd
commit a19a434e70
3 changed files with 51 additions and 23 deletions
+16 -4
View File
@@ -97,7 +97,7 @@ pub struct IndexEntry {
pub fields: HashMap<String, String>,
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Eq)]
pub struct LabeledIri {
pub iri: NamedNode,
pub label: String,
@@ -109,6 +109,18 @@ impl PartialEq for LabeledIri {
}
}
impl PartialOrd for LabeledIri {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.label.partial_cmp(&other.label)
}
}
impl Ord for LabeledIri {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.label.cmp(&other.label)
}
}
impl Display for LabeledIri {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.label)
@@ -255,8 +267,8 @@ WHERE {{
}
}
pub fn searchable_classes(&self, language: &LanguageCondition) -> impl Iterator<Item = LabeledIri> {
self.store.quads_for_pattern(None, Some(rdf::TYPE), Some(gl::SEARCHABLE.into()), None)
pub fn searchable_classes(&self, language: &LanguageCondition) -> BTreeSet<LabeledIri> {
self.store.quads_for_pattern(None, Some(rdf::TYPE), Some(gl::SEARCHABLE_CLASS.into()), None)
.filter_map(Result::ok)
.filter_map(|quad| {
let label = self.store.quads_for_pattern(Some(quad.subject.as_ref().into()), Some(rdfs::LABEL), None, None)
@@ -271,7 +283,7 @@ WHERE {{
label,
})
} else { None }
})
}).collect()
}
pub fn subclasses_of(&self, class: &NamedNode) -> BTreeSet<NamedNode> {