Skip to content

Commit

Permalink
filter out non string rdf types
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesamcl committed Aug 14, 2024
1 parent 8aae6e9 commit 2fe1c49
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion 01_ingest/grebi_ingest_rdf/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,12 @@ fn term_to_json(
}

if rdf_types_are_grebi_types && json.contains_key("http://www.w3.org/1999/02/22-rdf-syntax-ns#type") {
json.insert("grebi:type".to_string(), json.get("http://www.w3.org/1999/02/22-rdf-syntax-ns#type").unwrap().clone());
let types = json.get("http://www.w3.org/1999/02/22-rdf-syntax-ns#type").unwrap().as_array().unwrap();
json.insert("grebi:type".to_string(), Value::Array(
types.iter().filter(|t| t.is_string()).map(|t| {
Value::String(t.as_str().unwrap().to_string())
}).collect()
));
}

return Value::Object(json);
Expand Down

0 comments on commit 2fe1c49

Please sign in to comment.