Skip to content

Instantly share code, notes, and snippets.

@ioggstream
Created June 13, 2024 13:59
Show Gist options
  • Save ioggstream/bb2e6d4ac18f2df7d12e12406dbaae9e to your computer and use it in GitHub Desktop.
Save ioggstream/bb2e6d4ac18f2df7d12e12406dbaae9e to your computer and use it in GitHub Desktop.
Resident Person schema
#
# ## Welcome!
# Edit the following schema examples in this semantic editor
# based on Swagger Editor.
#
openapi: 3.0.3
components:
schemas:
EducationLevel:
x-jsonld-context:
"@vocab": "https://w3id.org/italia/onto/CPV/"
education_level:
"@id": "hasLevelOfEducation"
"@type": "@id"
"@context":
"@base": "https://w3id.org/italia/controlled-vocabulary/classifications-for-people/education-level/"
type: object
additionalProperties: false
properties:
education_level:
$ref: "https://onto.robertopolli.it/vocabularies/v1/vocabularies-schema/education-level?schema_type=anyOfenum#/SchemaVocabulary"
example:
education_level: NED
Parent:
x-jsonld-context:
"@vocab": "https://w3id.org/italia/onto/CPV/"
parent_id: taxCode
type: object
x-refersTo: https://w3id.org/italia/onto/CPV/Person
description: |-
Uno schema semplificato per associare una sola chiave
che identifica un genitore.
additionalProperties: false
required:
- parent_id
properties:
parent_id:
$ref: "#/components/schemas/TaxCode"
BirthPlace:
type: object
additionalProperties: false
required:
- city
- province
- country
x-jsonld-context: &BirthPlaceContext
"@vocab": "https://w3id.org/italia/onto/CLV/"
city: hasCity
country:
"@id": "hasCountry"
"@type": "@id"
"@context":
"@base": "http://publications.europa.eu/resource/authority/country/"
province:
"@id": "hasProvince"
"@type": "@id"
"@context":
"@base": "https://w3id.org/italia/data/identifiers/provinces-identifiers/vehicle-code/"
interno: null
properties:
city:
type: string
description: The city where the person was born.
example: Roma
province:
type: string
description: The province where the person was born.
example: RM
country:
type: string
description: The iso alpha-3 code of the country where the person was born.
example: ITA
postCode:
type: string
description: The post code (zip code)
example: "00100"
interno:
type: string
maxLength: 32
example:
city: Roma
province: RM
country: ITA
postCode: "00100"
interno: "Interno 8"
Person:
type: object
x-jsonld-type: https://w3id.org/italia/onto/CPV/Person
# This custom property defines the associated json-ld
# context that can be used to semantically describe
# the instances.
x-jsonld-context:
"@vocab": "https://w3id.org/italia/onto/CPV/"
RPO: "https://w3id.org/italia/onto/RPO/"
tax_code: taxCode
date_of_birth: dateOfBirth
given_name: givenName
family_name: familyName
education_level:
"@id": hasLevelOfEducation
"@type": "@id"
"@context":
"@base": "https://w3id.org/italia/controlled-vocabulary/classifications-for-people/education-level/"
birth_place:
"@id": "hasBirthPlace"
"@context":
<<: *BirthPlaceContext
children:
"@id": isParentOf
resident_in:
"@id": "RPO:currentlyHasRegisteredResidenceIn"
"@type": "@id"
"@context":
"@base": "https://w3id.org/italia/controlled-vocabulary/territorial-classifications/cities/"
parents:
"@id": isChildOf
additionalProperties: false
description: |-
Questo schema rappresenta una persona fisica.
required:
- given_name
- family_name
- tax_code
properties:
tax_code:
$ref: "#/components/schemas/TaxCode"
family_name:
maxLength: 255
type: string
resident_in:
type: string
maxLength: 255
example: "028001-(1924-12-28)"
given_name:
maxLength: 255
type: string
date_of_birth:
format: date
type: string
education_level:
type: string
maxLength: 3
description: |-
Il livello di istruzione della persona.
I valori ammessi sono indicati nel [vocabolario](https://w3id.org/italia/controlled-vocabulary/classifications-for-people/education-level)
birth_place:
$ref: "#/components/schemas/BirthPlace"
children:
type: array
items:
$ref: "#/components/schemas/Person"
minItems: 0
maxItems: 50
parents:
type: array
items:
$ref: "#/components/schemas/Parent"
maxItems: 2
minItems: 0
example:
tax_code: RSSMRA75L01H501A
family_name: Rossi
given_name: Mario
date_of_birth: "1961-01-01"
education_level: "NED"
resident_in: "028001-(1924-12-28)"
birth_place:
city: Roma
province: RM
country: ITA
children:
- tax_code: RSSMRA75L01H501A
- tax_code: RSSMRA76L01H501A
- tax_code: RSSMRA77L01H501A
TaxCode:
type: string
# Since jsonld does not support to attach a @context
# to a primitive type, we reference the semantic
# context using `x-refersTo.`
x-refersTo: https://w3id.org/italia/onto/CPV/taxCode
description: Il codice fiscale.
example: RSSMRA75L01H501A
maxLength: 16
minLength: 11
pattern: >-
[A-Z0-9]{16}
ExportedSchemas:
anyOf:
- $ref: "#/components/schemas/Person"
- $ref: "#/components/schemas/EducationLevel"
paths: {}
servers: []
tags: []
info:
title: A schema collection
version: 202108.01.00
x-summary: A schema collection with CPV ontology.
license:
name: BSD3
url: https://opensource.org/licenses/BSD-3-Clause
termsOfService: https://opensource.org/licenses/BSD-3-Clause
contact:
name: Roberto Polli
email: robipolli@gmail.com
url: http://spcdata.digitpa.gov.it/Amministrazione/agid
description: |-
## Welcome!
Edit the following schema examples in this semantic editor
based on Swagger Editor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment