Skip to content

Commit

Permalink
fix: always exclude blank nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdoret committed Oct 23, 2024
1 parent 4dfda39 commit 7ba7558
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fuzon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::{
use anyhow::Result;
use lazy_static::lazy_static;
use oxrdfio::{RdfFormat, RdfParser};
use oxrdf::Subject;
use postcard;
use reqwest::{blocking::Client, Url};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -164,8 +165,10 @@ pub fn gather_terms(readers: Vec<(impl BufRead, RdfFormat)>) -> impl Iterator<It
let mut terms = Vec::new();
for (reader, format) in readers {
let parser = RdfParser::from_format(format).for_reader(reader);
// Drop blank nodes and filter by common annotation properties
let mut out = parser
.map(|t| t.expect("Error parsing RDF"))
.filter(|t| if let Subject::NamedNode(_) = t.subject {true} else {false})
.filter(|t| ANNOTATIONS.contains(t.predicate.as_str()))
.map(|t| Term {
uri: t.subject.to_string(),
Expand Down

0 comments on commit 7ba7558

Please sign in to comment.