.
This commit is contained in:
+39
-14
@@ -1,5 +1,5 @@
|
||||
use std::fmt::Display;
|
||||
use oxigraph::model::{Graph, Literal, NamedNode, NamedNodeRef, NamedOrBlankNode, Term, Triple};
|
||||
use oxigraph::model::{Graph, Literal, LiteralRef, NamedNode, NamedNodeRef, NamedOrBlankNode, Term, TermRef, Triple};
|
||||
use oxilangtag::LanguageTag;
|
||||
use url::Url;
|
||||
use gl_search::Schema;
|
||||
@@ -125,28 +125,53 @@ impl Class {
|
||||
}
|
||||
|
||||
pub fn template(&self, subject: NamedNode) -> Graph {
|
||||
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("#");
|
||||
let subject = subject.as_ref();
|
||||
let empty_english_string_literal = LiteralRef::new_language_tagged_literal_unchecked("", "en");
|
||||
let empty_string_literal = LiteralRef::new_simple_literal("");
|
||||
let empty_node = NamedNodeRef::new_unchecked("");
|
||||
let hash_node = NamedNodeRef::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_term)
|
||||
Triple::new(subject, vocab::rdawd::TITLE_OF_WORK, empty_english_string_literal),
|
||||
Triple::new(subject, vocab::rdawo::IDENTIFIER_FOR_WORK, empty_node),
|
||||
Triple::new(subject, vocab::rdawo::EXPRESSION_OF_WORK, empty_node),
|
||||
]),
|
||||
Class::Person => Graph::from_iter([
|
||||
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),
|
||||
Triple::new(subject, vocab::rdaad::GIVEN_NAME, empty_english_string_literal),
|
||||
Triple::new(subject, vocab::rdaad::SURNAME, empty_english_string_literal),
|
||||
Triple::new(subject, vocab::rdaao::IDENTIFIER_FOR_PERSON, hash_node),
|
||||
Triple::new(hash_node, vocab::rdano::SCHEME_OF_NOMEN, empty_node),
|
||||
Triple::new(hash_node, vocab::rdand::NOMEN_STRING, empty_string_literal),
|
||||
]),
|
||||
Class::CorporateBody => Graph::from_iter([
|
||||
Triple::new(subject, vocab::rdaao::IDENTIFIER_FOR_CORPORATE_BODY, hash_node),
|
||||
Triple::new(subject, vocab::rdaad::NAME_OF_CORPORATE_BODY, empty_english_string_literal),
|
||||
Triple::new(hash_node, vocab::rdano::SCHEME_OF_NOMEN, empty_node),
|
||||
Triple::new(hash_node, vocab::rdand::NOMEN_STRING, empty_string_literal),
|
||||
]),
|
||||
Class::Expression => Graph::from_iter([
|
||||
Triple::new(subject, vocab::rdaeo::WORK_EXPRESSED, empty_node),
|
||||
Triple::new(subject, vocab::rdaeo::LANGUAGE_OF_EXPRESSION, vocab::lclang::ENGLISH),
|
||||
Triple::new(subject, vocab::rdaeo::TITLE_OF_EXPRESSION, empty_english_string_literal),
|
||||
Triple::new(subject, vocab::rdaeo::CONTENT_TYPE, empty_node),
|
||||
Triple::new(subject, vocab::rdaeo::MANIFESTATION_OF_EXPRESSION, empty_node),
|
||||
]),
|
||||
Class::Manifestation => Graph::from_iter([
|
||||
Triple::new(subject, vocab::rdamd::TITLE_OF_MANIFESTATION, empty_english_string_literal),
|
||||
Triple::new(subject, vocab::rdamd::UNIFORM_RESOURCE_LOCATOR, empty_string_literal),
|
||||
Triple::new(subject, vocab::rdamo::CARRIER_TYPE, vocab::rdact::ONLINE_RESOURCE),
|
||||
Triple::new(subject, vocab::rdamo::MEDIA_TYPE, empty_node),
|
||||
Triple::new(subject, vocab::rdamo::FILE_TYPE, empty_node),
|
||||
Triple::new(subject, vocab::rdamo::CATEGORY_OF_MANIFESTATION, empty_node),
|
||||
Triple::new(subject, vocab::rdamo::EXPRESSION_MANIFESTED, empty_node),
|
||||
Triple::new(subject, vocab::rdamo::IDENTIFIER_FOR_MANIFESTATION, hash_node),
|
||||
Triple::new(hash_node, vocab::rdano::SCHEME_OF_NOMEN, empty_node),
|
||||
Triple::new(hash_node, vocab::rdand::NOMEN_STRING, empty_string_literal),
|
||||
]),
|
||||
Class::CorporateBody => Graph::new(),
|
||||
Class::Expression => Graph::new(),
|
||||
Class::Manifestation => Graph::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,11 +106,11 @@ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
||||
PREFIX gl: <https://graphofliberty.org/2026/04/ont/>
|
||||
|
||||
SELECT ?subject ?class WHERE {{
|
||||
VALUES ?class {{ rdf:Property rdfs:Class }}
|
||||
SELECT ?subject ?class WHERE {
|
||||
VALUES ?class { rdf:Property rdfs:Class }
|
||||
?subject a ?class ;
|
||||
gl:readOnly "true"^^xsd:boolean .
|
||||
}}"#.to_owned();
|
||||
}"#.to_owned();
|
||||
|
||||
let request = OntologyQueryRequest {
|
||||
sparql_query: Some(sparql_query),
|
||||
|
||||
+74
-3
@@ -14,11 +14,11 @@ pub mod glo {
|
||||
NamedNodeRef::new_unchecked("https://graphofliberty.org/2026/04/ont/nextUrl");
|
||||
}
|
||||
|
||||
pub mod skos {
|
||||
pub mod lclang {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
pub const CONCEPT: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://www.w3.org/2004/02/skos/core#Concept");
|
||||
pub const ENGLISH: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://id.loc.gov/vocabulary/languages/eng");
|
||||
}
|
||||
|
||||
pub mod owl {
|
||||
@@ -47,6 +47,13 @@ pub mod rdac {
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/c/C10007");
|
||||
}
|
||||
|
||||
pub mod rdact {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
pub const ONLINE_RESOURCE: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/termList/RDACarrierType/1018");
|
||||
}
|
||||
|
||||
pub mod rdaad {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
@@ -65,6 +72,9 @@ pub mod rdaao {
|
||||
|
||||
pub const IDENTIFIER_FOR_PERSON: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/a/object/P50094");
|
||||
|
||||
pub const IDENTIFIER_FOR_CORPORATE_BODY: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/a/object/P50006");
|
||||
}
|
||||
|
||||
pub mod rdawd {
|
||||
@@ -74,6 +84,16 @@ pub mod rdawd {
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/w/datatype/P10088");
|
||||
}
|
||||
|
||||
pub mod rdawo {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
pub const IDENTIFIER_FOR_WORK: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/w/object/P10002");
|
||||
|
||||
pub const EXPRESSION_OF_WORK: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/w/object/P10078");
|
||||
}
|
||||
|
||||
pub mod rdaed {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
@@ -81,11 +101,55 @@ pub mod rdaed {
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/e/datatype/P20312");
|
||||
}
|
||||
|
||||
pub mod rdaeo {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
pub const WORK_EXPRESSED: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/e/object/P20231");
|
||||
|
||||
pub const LANGUAGE_OF_EXPRESSION: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/e/object/P20006");
|
||||
|
||||
pub const TITLE_OF_EXPRESSION: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/e/datatype/P20312");
|
||||
|
||||
pub const CONTENT_TYPE: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/e/object/P20001");
|
||||
|
||||
pub const MANIFESTATION_OF_EXPRESSION: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/e/object/P20059");
|
||||
}
|
||||
|
||||
pub mod rdamd {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
pub const TITLE_OF_MANIFESTATION: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/m/datatype/P30335");
|
||||
|
||||
pub const UNIFORM_RESOURCE_LOCATOR: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/m/datatype/P30154");
|
||||
}
|
||||
|
||||
pub mod rdamo {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
pub const CARRIER_TYPE: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/m/object/P30001");
|
||||
|
||||
pub const MEDIA_TYPE: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/m/object/P30002");
|
||||
|
||||
pub const IDENTIFIER_FOR_MANIFESTATION: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/m/object/P30004");
|
||||
|
||||
pub const FILE_TYPE: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/m/object/P30018");
|
||||
|
||||
pub const CATEGORY_OF_MANIFESTATION: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/m/object/P30335");
|
||||
|
||||
pub const EXPRESSION_MANIFESTED: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/m/object/P30139");
|
||||
}
|
||||
|
||||
pub mod rdand {
|
||||
@@ -100,4 +164,11 @@ pub mod rdano {
|
||||
|
||||
pub const SCHEME_OF_NOMEN: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://rdaregistry.info/Elements/n/object/P80069");
|
||||
}
|
||||
|
||||
pub mod skos {
|
||||
use oxigraph::model::NamedNodeRef;
|
||||
|
||||
pub const CONCEPT: NamedNodeRef =
|
||||
NamedNodeRef::new_unchecked("http://www.w3.org/2004/02/skos/core#Concept");
|
||||
}
|
||||
Reference in New Issue
Block a user