.
This commit is contained in:
+15
-7
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Display;
|
||||
use oxigraph::model::{Graph, Literal, NamedNode, NamedNodeRef, NamedOrBlankNode, Term, Triple};
|
||||
use oxigraph::model::{Graph, Literal, NamedNode, NamedNodeRef, NamedOrBlankNode, Term, TermRef, Triple};
|
||||
use oxilangtag::LanguageTag;
|
||||
use url::Url;
|
||||
use gl_search::Schema;
|
||||
@@ -118,25 +118,33 @@ impl Class {
|
||||
pub fn next_url(&self) -> Option<Url> {
|
||||
match self {
|
||||
Class::Work => Some(Url::parse("http://fedora.quill.lan/rest/#Work").unwrap()),
|
||||
Class::Person => Some(Url::parse("http://fedora.quill.lan/rest/#Agent").unwrap()),
|
||||
Class::CorporateBody => Some(Url::parse("http://fedora.quill.lan/rest/#Agent").unwrap()),
|
||||
Class::Expression => Some(Url::parse("http://fedora.quill.lan/rest/#Expression").unwrap()),
|
||||
Class::Manifestation => Some(Url::parse("http://fedora.quill.lan/rest/#Manifestation").unwrap()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn template(&self, subject: NamedNode) -> Graph {
|
||||
let empty_english_string = Term::Literal(Literal::new_language_tagged_literal_unchecked("", "en"));
|
||||
let empty_node = Term::NamedNode(NamedNode::new_unchecked("#"));
|
||||
let empty_english_string_term = Term::Literal(Literal::new_language_tagged_literal_unchecked("", "en"));
|
||||
let empty_string_term = Term::Literal(Literal::new_simple_literal(""));
|
||||
let empty_node = NamedNode::new_unchecked("");
|
||||
let hash_node = NamedNode::new_unchecked("#");
|
||||
|
||||
match self {
|
||||
Class::RdfProperty => Graph::new(),
|
||||
Class::RdfsClass => Graph::new(),
|
||||
Class::SkosConcept => Graph::new(),
|
||||
Class::Work => Graph::from_iter([
|
||||
Triple::new(NamedOrBlankNode::NamedNode(subject), vocab::rdawd::TITLE_OF_WORK, empty_english_string)
|
||||
Triple::new(NamedOrBlankNode::NamedNode(subject), vocab::rdawd::TITLE_OF_WORK, empty_english_string_term)
|
||||
]),
|
||||
Class::Person => Graph::from_iter([
|
||||
Triple::new(NamedOrBlankNode::NamedNode(subject.clone()), vocab::rdaao::IDENTIFIER_FOR_PERSON, empty_node),
|
||||
Triple::new(NamedOrBlankNode::NamedNode(subject.clone()), vocab::rdaad::GIVEN_NAME, empty_english_string.clone()),
|
||||
Triple::new(NamedOrBlankNode::NamedNode(subject), vocab::rdaad::SURNAME, empty_english_string),
|
||||
Triple::new(NamedOrBlankNode::NamedNode(subject.clone()), vocab::rdaad::GIVEN_NAME, empty_english_string_term.clone()),
|
||||
Triple::new(NamedOrBlankNode::NamedNode(subject.clone()), vocab::rdaad::SURNAME, empty_english_string_term),
|
||||
Triple::new(NamedOrBlankNode::NamedNode(subject.clone()), vocab::rdaao::IDENTIFIER_FOR_PERSON, Term::NamedNode(hash_node.clone())),
|
||||
Triple::new(NamedOrBlankNode::NamedNode(hash_node.clone()), vocab::rdano::SCHEME_OF_NOMEN, Term::NamedNode(empty_node)),
|
||||
Triple::new(NamedOrBlankNode::NamedNode(subject.clone()), vocab::rdand::NOMEN_STRING, empty_string_term),
|
||||
]),
|
||||
Class::CorporateBody => Graph::new(),
|
||||
Class::Expression => Graph::new(),
|
||||
|
||||
+4
-3
@@ -19,9 +19,10 @@ pub static PREFIXES: LazyLock<BTreeMap<String, String>> = LazyLock::new(|| {
|
||||
"http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#",
|
||||
),
|
||||
("prov", "http://www.w3.org/ns/prov#"),
|
||||
("locid", "http://id.loc.gov/vocabulary/identifiers/"),
|
||||
("locname", "http://id.loc.gov/authorities/names/"),
|
||||
("loclang", "http://id.loc.gov/vocabulary/languages/"),
|
||||
("lcid", "http://id.loc.gov/vocabulary/identifiers/"),
|
||||
("lca", "http://id.loc.gov/authorities/"),
|
||||
("lcn", "http://id.loc.gov/authorities/names/"),
|
||||
("lclang", "http://id.loc.gov/vocabulary/languages/"),
|
||||
("viaf", "http://viaf.org/viaf/"),
|
||||
("premis", "http://www.loc.gov/premis/rdf/v1#"),
|
||||
("premis3", "http://www.loc.gov/premis/rdf/v3/"),
|
||||
|
||||
@@ -86,4 +86,18 @@ pub mod rdamd {
|
||||
|
||||
pub const TITLE_OF_MANIFESTATION: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/m/datatype/P30335");
|
||||
}
|
||||
|
||||
pub mod rdand {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
pub const NOMEN_STRING: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/n/datatype/P80068");
|
||||
}
|
||||
|
||||
pub mod rdano {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
pub const SCHEME_OF_NOMEN: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/n/object/P80069");
|
||||
}
|
||||
Reference in New Issue
Block a user