.
This commit is contained in:
+20
-2
@@ -56,6 +56,24 @@ impl<'a> Indexer<'a> {
|
||||
])
|
||||
}
|
||||
|
||||
fn work(&self, graph: &Graph, subject: NamedNodeRef) -> HashMap<Field, OwnedValue> {
|
||||
HashMap::from_iter([
|
||||
(
|
||||
Schema::field("title", self.language.primary_language()),
|
||||
self.extract_string(graph, subject, vocab::rdawd::TITLE_OF_WORK),
|
||||
),
|
||||
])
|
||||
}
|
||||
|
||||
fn expression(&self, graph: &Graph, subject: NamedNodeRef) -> HashMap<Field, OwnedValue> {
|
||||
HashMap::from_iter([
|
||||
(
|
||||
Schema::field("title", self.language.primary_language()),
|
||||
self.extract_string(graph, subject, vocab::rdaed::TITLE_OF_EXPRESSION),
|
||||
),
|
||||
])
|
||||
}
|
||||
|
||||
pub fn graph(&self, graph: &Graph) -> crate::Result<Vec<HashMap<Field, OwnedValue>>> {
|
||||
let mut entities_and_types = HashSet::new();
|
||||
let triples = graph.triples_for_predicate(vocab::rdf::TYPE);
|
||||
@@ -73,10 +91,10 @@ impl<'a> Indexer<'a> {
|
||||
Class::RdfProperty => None,
|
||||
Class::RdfsClass => None,
|
||||
Class::SkosConcept => None,
|
||||
Class::Work => Some(self.person(graph, *subject)),
|
||||
Class::Work => Some(self.work(graph, *subject)),
|
||||
Class::Person => Some(self.person(graph, *subject)),
|
||||
Class::CorporateBody => Some(self.corporate_body(graph, *subject)),
|
||||
Class::Expression => Some(self.person(graph, *subject)),
|
||||
Class::Expression => Some(self.expression(graph, *subject)),
|
||||
Class::Manifestation => Some(self.person(graph, *subject)),
|
||||
}.map(|mut document| {
|
||||
document.insert(Schema::discriminant_field(), OwnedValue::from(class as u64));
|
||||
|
||||
@@ -56,3 +56,17 @@ pub mod rdaad {
|
||||
pub const NAME_OF_CORPORATE_BODY: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/a/datatype/P50032");
|
||||
}
|
||||
|
||||
pub mod rdawd {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
pub const TITLE_OF_WORK: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/w/datatype/P10088");
|
||||
}
|
||||
|
||||
pub mod rdaed {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
pub const TITLE_OF_EXPRESSION: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/e/datatype/P20312");
|
||||
}
|
||||
Reference in New Issue
Block a user