Closed frederik-ronnevig closed 3 years ago
I det nye biblioteket servicecatalogtordf har eg løyst dette på ein annan måte:
service = Service("http://example.com/services/1") public_organization = PublicOrganization("https://my.public.organization") service.has_competent_authority = public_organization src = """ @prefix dct: <http://purl.org/dc/terms/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix cpsv: <http://purl.org/vocab/cpsv#> . @prefix cv: <http://data.europa.eu/m8g/> . <http://example.com/services/1> a cpsv:PublicService ; cv:hasCompetentAuthority <https://my.public.organization> ; . """ g1 = Graph().parse(data=service.to_rdf(), format="turtle") g2 = Graph().parse(data=src, format="turtle") assert_isomorphic(g1, g2)
Viss brukar gjer:
service = Service("http://example.com/services/1") public_organization = PublicOrganization() service.has_competent_authority = public_organization ...
Blir public organization ei blank node, og dermed skolemisert, as usual.
På denne måten slepp brukar å ta stilling til str/instans av klasse.
Gjøres ved å endre konstruktøren:
def __init__(self, identifier: Optional[str] = None) -> None: """Inits an object with default values.""" self.identifier = identifier
_Originally posted by @stigbd in https://github.com/Informasjonsforvaltning/datacatalogtordf/pull/38#discussion_r640405614_
Ferdigstilt.
I det nye biblioteket servicecatalogtordf har eg løyst dette på ein annan måte:
Viss brukar gjer:
Blir public organization ei blank node, og dermed skolemisert, as usual.
På denne måten slepp brukar å ta stilling til str/instans av klasse.
Gjøres ved å endre konstruktøren:
_Originally posted by @stigbd in https://github.com/Informasjonsforvaltning/datacatalogtordf/pull/38#discussion_r640405614_