From 9c440ca105e3a0108586a81d75b49a3d789d7ed0 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 16 May 2023 14:37:31 -0700 Subject: [PATCH] Guard against URIs (not QNames) being used for tags. --- lib/rdf/rdfxml/writer.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rdf/rdfxml/writer.rb b/lib/rdf/rdfxml/writer.rb index 7fb27f7..b7f11e5 100644 --- a/lib/rdf/rdfxml/writer.rb +++ b/lib/rdf/rdfxml/writer.rb @@ -259,6 +259,7 @@ def render_subject(subject, builder, **options, &block) # The first type is used for first_type = types.shift type_qname = get_qname(first_type) if first_type + type_qname = nil unless type_qname.is_a?(String) types.unshift(first_type) if first_type && !type_qname type_qname ||= "rdf:Description" @@ -619,7 +620,7 @@ def expand_curie(curie) # Turn CURIE into a QNAME or return the RDF::URI def get_qname(uri) curie = get_curie(uri) - if curie.nil? + if curie.nil? || curie == ':' uri elsif curie.start_with?(":") curie[1..-1]