Compare commits
No commits in common. "e81120d35376ff18cbf5f58f156bb8f8f6608e03" and "34754cc68a31862c4d1bc064207fe41f1ce88e05" have entirely different histories.
e81120d353
...
34754cc68a
4 changed files with 367997 additions and 326775 deletions
21
Rakefile
21
Rakefile
|
|
@ -61,18 +61,6 @@ file 'data/works.ttl' => 'src/map_work.rb' do
|
||||||
run 'src/map_work.rb'
|
run 'src/map_work.rb'
|
||||||
end
|
end
|
||||||
|
|
||||||
# ── Pipeline steps ───────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
file 'data/graph-01.ttl' => 'map/step-01.rb' do
|
|
||||||
run 'map/step-01.rb'
|
|
||||||
end
|
|
||||||
|
|
||||||
UPDATE_QUERIES = FileList['updates/*.rq']
|
|
||||||
|
|
||||||
file 'data/graph-02.ttl' => ['data/graph-01.ttl', 'map/step-02.rb'] + UPDATE_QUERIES do
|
|
||||||
run 'map/step-02.rb'
|
|
||||||
end
|
|
||||||
|
|
||||||
# ── Aggregate tasks ──────────────────────────────────────────────────────────
|
# ── Aggregate tasks ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
GENERATED = %w[
|
GENERATED = %w[
|
||||||
|
|
@ -91,17 +79,12 @@ GENERATED = %w[
|
||||||
data/works.ttl
|
data/works.ttl
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
GRAPHS = %w[
|
task default: GENERATED
|
||||||
data/graph-01.ttl
|
|
||||||
data/graph-02.ttl
|
|
||||||
].freeze
|
|
||||||
|
|
||||||
task default: GENERATED + GRAPHS
|
|
||||||
|
|
||||||
task :clean do
|
task :clean do
|
||||||
review_files = %w[
|
review_files = %w[
|
||||||
data/countries_wikidata_review.ttl
|
data/countries_wikidata_review.ttl
|
||||||
data/religions_wikidata_review.ttl
|
data/religions_wikidata_review.ttl
|
||||||
]
|
]
|
||||||
rm_f GENERATED + GRAPHS + review_files
|
rm_f GENERATED + review_files
|
||||||
end
|
end
|
||||||
|
|
|
||||||
344115
data/graph-01.ttl
344115
data/graph-01.ttl
File diff suppressed because it is too large
Load diff
350623
data/graph-02.ttl
350623
data/graph-02.ttl
File diff suppressed because it is too large
Load diff
|
|
@ -79,19 +79,10 @@ fn class_iri(table: &str) -> SimpleTerm<'static> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sanitize_name(name: &str) -> String {
|
|
||||||
let s: String = name
|
|
||||||
.chars()
|
|
||||||
.map(|c| if c.is_ascii_alphanumeric() || c == '-' { c } else { '_' })
|
|
||||||
.collect();
|
|
||||||
let s = s.replace("__", "_");
|
|
||||||
s.trim_matches('_').to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn column_iri(table: &str, column: &str) -> SimpleTerm<'static> {
|
fn column_iri(table: &str, column: &str) -> SimpleTerm<'static> {
|
||||||
SimpleTerm::Iri(
|
SimpleTerm::Iri(
|
||||||
sophia::api::term::IriRef::new_unchecked(
|
sophia::api::term::IriRef::new_unchecked(
|
||||||
format!("{}{}#{}", BASE_IRI, table, sanitize_name(column)).into(),
|
format!("{}{}#{}", BASE_IRI, table, column).into(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -99,7 +90,7 @@ fn column_iri(table: &str, column: &str) -> SimpleTerm<'static> {
|
||||||
fn ref_iri(table: &str, fk_col: &str) -> SimpleTerm<'static> {
|
fn ref_iri(table: &str, fk_col: &str) -> SimpleTerm<'static> {
|
||||||
SimpleTerm::Iri(
|
SimpleTerm::Iri(
|
||||||
sophia::api::term::IriRef::new_unchecked(
|
sophia::api::term::IriRef::new_unchecked(
|
||||||
format!("{}{}#ref-{}", BASE_IRI, table, sanitize_name(fk_col)).into(),
|
format!("{}{}#ref-{}", BASE_IRI, table, fk_col).into(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue