From d90c0b040d93f014b9a08d4dac7dacf656ca609968199d806e916a1de996a57d Mon Sep 17 00:00:00 2001 From: Alex Wied <2+alex@noreply.code.graphofliberty.org> Date: Sat, 25 Jul 2026 23:08:19 -0400 Subject: [PATCH] . --- publish/src/app.rs | 33 +++++++++++++++++++++++---------- publish/src/rdf/ontology.rs | 8 ++++++-- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/publish/src/app.rs b/publish/src/app.rs index 15de87a..311323c 100644 --- a/publish/src/app.rs +++ b/publish/src/app.rs @@ -6,7 +6,7 @@ use http::StatusCode; use iced::alignment::Horizontal; use iced::widget::button::Style; use iced::widget::grid::Sizing; -use iced::widget::{button, center, column, combo_box, container, grid, mouse_area, opaque, pick_list, row, scrollable, space, stack, table, text, text_input, toggler}; +use iced::widget::{button, center, column, combo_box, container, grid, mouse_area, opaque, operation, pick_list, row, scrollable, space, stack, table, text, text_input, toggler}; use iced::window::Settings; use iced::{Background, Color, Element, Length, Subscription, Task, color, window}; use iced::widget::text::Wrapping; @@ -392,7 +392,7 @@ impl Publisher { query: String::new(), results: Vec::new(), }); - task = window_task.map(|_| Message::None); + task = window_task.then(|_| operation::focus("query")); } if let Some(selected_entity_class) = selected_entity_class { @@ -680,14 +680,26 @@ impl Publisher { }) .unwrap_or(Horizontal::Left); - let object_input_base = iri_input(&self.curie_helper, "Object", Some(&base), value.as_str()) - .on_shift_click(Message::NavigateToObject(key)); - let object_input = if self.ontology.is_read_only(triple.as_ref()) { - object_input_base + // If the datatype is something, then it's not a named node, and we should use a plain + // text_input as opposed to an iri_input. + let object_input: Element = if term.datatype().is_some() { + let base = text_input("Object", value.as_str()); + if self.ontology.is_read_only(triple.as_ref()) { + base.into() + } else { + base.on_input(move |value| Message::ObjectUpdated(key, value)).into() + } } else { - object_input_base.align_x(value_alignment) - .on_input(move |value| Message::ObjectUpdated(key, value)) - .on_control_click(Message::OpenQueryWindow(SearchResultClickAction::Object(key))) + let base = iri_input(&self.curie_helper, "Object", Some(&base), value.as_str()) + .on_shift_click(Message::NavigateToObject(key)); + if self.ontology.is_read_only(triple.as_ref()) { + base.into() + } else { + base.align_x(value_alignment) + .on_input(move |value| Message::ObjectUpdated(key, value)) + .on_control_click(Message::OpenQueryWindow(SearchResultClickAction::Object(key))) + .into() + } }; let selected_datatype = term.datatype() @@ -781,7 +793,8 @@ impl Publisher { && search_state.window_id == window { let search_input = - text_input("Query", &search_state.query).on_input(Message::QueryUpdated); + text_input("Query", &search_state.query).on_input(Message::QueryUpdated) + .id("query"); let entities = self.ontology .searchable_classes(&*language::ENGLISH_OR_UNTAGGED) diff --git a/publish/src/rdf/ontology.rs b/publish/src/rdf/ontology.rs index af4aac5..3af8a2a 100644 --- a/publish/src/rdf/ontology.rs +++ b/publish/src/rdf/ontology.rs @@ -31,6 +31,7 @@ static PREFIXES: LazyLock> = LazyLock::new(|| { ), ("prov", "http://www.w3.org/ns/prov#"), ("locid", "http://id.loc.gov/vocabulary/identifiers/"), + ("loclang", "http://id.loc.gov/vocabulary/languages/"), ("premis", "http://www.loc.gov/premis/rdf/v1#"), ("premis3", "http://www.loc.gov/premis/rdf/v3/"), ("dcterms", "http://purl.org/dc/terms/"), @@ -47,9 +48,12 @@ static PREFIXES: LazyLock> = LazyLock::new(|| { ("rdau", "http://rdaregistry.info/Elements/u/"), ("rdaw", "http://rdaregistry.info/Elements/w/"), ("rdax", "http://rdaregistry.info/Elements/x/"), + ("rdaco", "http://rdaregistry.info/termList/RDAContentType/"), + ("rdact", "http://rdaregistry.info/termList/RDACarrierType/"), + ("rdaft", "http://rdaregistry.info/termList/fileType/"), ("schema", "https://schema.org/"), - ("quill", "http://fedora.quill.lan/rest/"), - ("gl", ONTOLOGY_PREFIX), + ("gl", "http://fedora.quill.lan/rest/"), + ("glo", ONTOLOGY_PREFIX), ].map(|(k, v)| (k.to_string(), v.to_string()))) });