.
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user