Skip to content

Commit

Permalink
Merge pull request #10 from RDFLib/edmond/vocexcel-web
Browse files Browse the repository at this point in the history
feat: support multiple sources in concepts sheet and multiple custodians in concept scheme sheet
  • Loading branch information
edmondchuc authored Sep 18, 2023
2 parents ddb58df + 060cb37 commit 91d3993
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions vocexcel/convert_062.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def extract_prefixes(sheet: Worksheet) -> dict[str, Namespace]:
return prefixes


def extract_concept_scheme(sheet: Worksheet, prefixes) -> Graph:
def extract_concept_scheme(sheet: Worksheet, prefixes) -> tuple[Graph, str]:
iri_s = sheet["B3"].value
title = sheet["B4"].value
description = sheet["B5"].value
Expand Down Expand Up @@ -133,11 +133,12 @@ def extract_concept_scheme(sheet: Worksheet, prefixes) -> Graph:
g.add((iri, OWL.versionIRI, URIRef(iri + "/" + str(version))))

if custodian is not None:
ISOROLES = Namespace(
"http://def.isotc211.org/iso19115/-1/2018/CitationAndResponsiblePartyInformation/code/CI_RoleCode/"
)
g += make_agent(custodian, ISOROLES.custodian, prefixes, iri)
g.bind("isoroles", ISOROLES)
for _custodian in split_and_tidy_to_strings(custodian):
ISOROLES = Namespace(
"http://def.isotc211.org/iso19115/-1/2018/CitationAndResponsiblePartyInformation/code/CI_RoleCode/"
)
g += make_agent(_custodian, ISOROLES.custodian, prefixes, iri)
g.bind("isoroles", ISOROLES)

# auto-created
g.add((iri, DCTERMS.identifier, id_from_iri(iri)))
Expand Down Expand Up @@ -207,7 +208,10 @@ def extract_concepts(sheet: Worksheet, prefixes, cs_iri) -> Graph:
g.add((iri, SKOS.historyNote, Literal(history_note.strip())))

if source is not None:
g.add((iri, DCTERMS.source, Literal(source.strip(), datatype=XSD.anyURI)))
for _source in split_and_tidy_to_strings(source):
g.add(
(iri, DCTERMS.source, Literal(_source.strip(), datatype=XSD.anyURI))
)

if home is not None:
g.add((iri, RDFS.isDefinedBy, URIRef(home.strip())))
Expand Down

0 comments on commit 91d3993

Please sign in to comment.