Skip to content

Commit

Permalink
core: ndc: add other types to ndc named individuals
Browse files Browse the repository at this point in the history
Looks like agents and contacts are asserted to belong to more
than one class.
  • Loading branch information
mnamici committed Dec 11, 2024
1 parent efea0c6 commit f0e4354
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions eddy/core/ndc.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,20 @@ class ADMS(DefinedNamespace):
_NS = Namespace('https://w3id.org/italia/onto/ADMS/')


# Subset of the dcatapit ontology vocabulary
class DCATAPIT(DefinedNamespace):
Agent: URIRef
Organization: URIRef
_NS = Namespace('http://dati.gov.it/onto/dcatapit#')


# Subset of the vcard ontology vocabulary
class VCARD(DefinedNamespace):
Kind: URIRef
fn: URIRef
hasEmail: URIRef
hasTelephone: URIRef
Organization: URIRef
_NS = Namespace('http://www.w3.org/2006/vcard/ns#')


Expand All @@ -104,6 +112,7 @@ def triples(self) -> Iterable:
"""
return [
(self.uri, RDF.type, Agent.type),
(self.uri, RDF.type, DCATAPIT.Agent),
(self.uri, FOAF.name, self.name_en),
(self.uri, FOAF.name, self.name_it),
(self.uri, DCTERMS.identifier, self.identifier),
Expand Down Expand Up @@ -171,6 +180,8 @@ def triples(self) -> Iterable:
"""
return [
(self.uri, RDF.type, ContactPoint.type),
(self.uri, RDF.type, DCATAPIT.Organization),
(self.uri, RDF.type, VCARD.Organization),
(self.uri, VCARD.fn, self.fn_en),
(self.uri, VCARD.fn, self.fn_it),
(self.uri, VCARD.hasEmail, self.email),
Expand Down Expand Up @@ -386,7 +397,6 @@ class NDCDataset(Dataset):
custom methods that extract the relevant entities for the national data catalog.
"""
DEFAULT_GRAPH = 'urn:x-eddy:ndc:'
STORE_PATH = expandPath('@data/ndc.trig')

def __init__(
self,
Expand Down Expand Up @@ -467,11 +477,11 @@ def load(self, path: str = None) -> Graph:
"""
if path:
return self.parse(path)
elif fexists(NDCDataset.STORE_PATH):
return self.parse(NDCDataset.STORE_PATH)
elif fexists(expandPath('@data/ndc.trig')):
return self.parse(expandPath('@data/ndc.trig'))

def save(self) -> None:
"""
Saves this dataset to the default user destination.
"""
self.serialize(NDCDataset.STORE_PATH, format='trig')
self.serialize(expandPath('@data/ndc.trig'), format='trig')

0 comments on commit f0e4354

Please sign in to comment.