-
Notifications
You must be signed in to change notification settings - Fork 0
Data Model
David Park edited this page Oct 20, 2023
·
1 revision
This page shows all the data models created by createGraphDBModel. To understand what each attribute and option means in the definition of these models, you should be familiar with the parameters and types of GraphDB utils first.
The content is a copy and pasted version of the source code. You can find them in backend/models
.
const GDBAddressModel = createGraphDBModel({
lat: {type: String, internalKey: 'geo:lat'},
lng: {type: String, internalKey: 'geo:long'},
// iContact Ontology defines the type as nonNegativeNumber,
// but this should be a string since some unit numbers are not just pure number.
unitNumber: {type: String, internalKey: 'ic:hasUnitNumber'},
streetNumber: {type: String, internalKey: 'ic:hasStreetNumber'},
streetName: {type: String, internalKey: 'ic:hasStreet'},
streetType: {type: GDBStreetType, internalKey: 'ic:hasStreetType'},
streetDirection: {type: GDBStreetDirection, internalKey: 'ic:hasStreetDirection'},
city: {type: String, internalKey: 'ic:hasCityS'},
citySection: {type: String, internalKey: 'ic:hasCitySection'},
country: {type: GDBSchemaCountry, internalKey: 'ic:hasCountry'},
state: {type: GDBSchemaState, internalKey: 'ic:hasState'},
postalCode: {type: String, internalKey: 'ic:hasPostalCode'},
}, {
rdfTypes: ['ic:Address'], name: 'address'
});
const GDBCharacteristicModel = createGraphDBModel({
codes: {type: [GDBCodeModel], internalKey: 'cids:hasCode'},
stakeholders: {type: [() => require('./stakeholder').GDBStakeholderModel], internalKey: 'cids:forStakeholder'},
name: {type: String, internalKey: 'cids:hasName'},
value: {type: String, internalKey: 'iso21972:value'}
}, {
rdfTypes: ['cids:Characteristic'], name: 'characteristic'
});
const GDBCodeModel = createGraphDBModel({
definedBy: {type: () => require('./organization').GDBOrganizationModel, internalKey: 'cids:definedBy'},
specification: {type: String, internalKey: 'cids:hasSpecification'},
identifier: {type: String, internalKey: 'tove_org:hasIdentifier'},
name: {type: String, internalKey: 'cids:hasName'},
description: {type: String, internalKey: 'cids:hasDescription'},
codeValue: {type: String, internalKey: 'schema:codeValue'},
iso72Value: {type: GDBMeasureModel, internalKey: 'iso21972:value'}
}, {
rdfTypes: ['cids:Code'], name: 'code'
});
const GDBGroupModel = createGraphDBModel({
label: {type: String, internalKey: 'rdfs:label'},
comment: {type: String, internalKey: 'rdfs:comment'},
administrator: {type: GDBUserAccountModel, internalKey: ':hasAdministrator'},
organizations: {type: [GDBOrganizationModel], internalKey: ':hasOrganization'},
}, {
rdfTypes: [':Group'], name: 'group'
});
const GDBHowMuchImpactModel = createGraphDBModel({
indicator: {type: GDBIndicatorModel, internalKey: 'cids:forIndicator'},
value: {type: GDBMeasureModel, internalKey: 'iso21972:value'},
}, {
rdfTypes: ['owl:NamedIndividual', 'cids:HowMuchImpact'], name: 'howMuchImpact'
});
const GDBImpactReportModel = createGraphDBModel({
name: {type: String, internalKey: 'cids:hasName'},
comment: {type: String, internalKey: 'cids:hasComment'},
forStakeholderOutcome: {type: () => require('./stakeholderOutcome').GDBStakeholderOutcomeModel, internalKey: 'cids:forOutcome'},
forOrganization: {type: () => require('./organization').GDBOrganizationModel, internalKey: 'cids:forOrganization'},
impactScale: {type: () => require('./howMuchImpact').GDBImpactScaleModel, internalKey: 'cids:hasImpactScale'},
impactDepth: {type: () => require('./howMuchImpact').GDBImpactDepthModel, internalKey: 'cids:hasImpactDepth'}
}, {
rdfTypes: ['cids:ImpactReport'], name: 'impactReport'
});
const GDBImpactModelModel = createGraphDBModel({
name: {type: String, internalKey: 'cids:hasName'},
description: {type: String, internalKey: 'cids:hasName'},
organization: {type: GDBOrganizationModel, internalKey: 'cids:forDescription'},
}, {
rdfTypes: ['cids:ImpactModel'], name: 'impactModel'
});
const GDBImpactNormsModel = createGraphDBModel({
name: {type: String, internalKey: 'cids:hasName'},
description: {type: String, internalKey: 'cids:hasName'},
organization: {type: GDBOrganizationModel, internalKey: 'cids:forOrganization'},
stakeholders: {type: [GDBStakeholderModel], internalKey: 'cids:hasStakeholder'},
outcomes: {type: [GDBOutcomeModel], internalKey: 'cids:hasOutcome'},
stakeholderOutcomes: {type: [require('./stakeholderOutcome').GDBStakeholderOutcomeModel], internalKey: 'cids:hasStakeholderOutcome'},
indicators: {type: [GDBIndicatorModel], internalKey: 'cids:hasIndicator'},
impactReports: {type: [require('./impactReport').GDBImpactReportModel], internalKey: 'cids:hasImpactReport'},
indicatorReports: {type: [GDBIndicatorReportModel], internalKey: 'cids:hasIndicatorReport'}
}, {
rdfTypes: ['cids:ImpactModel', "cids:ImpactNorms"], name: 'impactNorms'
});
const GDBIndicatorModel = createGraphDBModel({
name: {type: String, internalKey: 'cids:hasName'}, // todo: here is issue, on protege, it should be tov_org:hasName
description: {type: String, internalKey: 'cids:hasDescription'},
forOutcomes: {type: [GDBOutcomeModel], internalKey: 'cids:forOutcome'},
indicatorReports: {type: [GDBIndicatorReportModel], internalKey: 'cids:hasIndicatorReport'},
forOrganization: {type: () => require('./organization').GDBOrganizationModel, internalKey: 'cids:definedBy'},
unitOfMeasure: {type: () => require('./measure').GDBUnitOfMeasure, internalKey: 'iso21972:unit_of_measure'},
codes: {type: [() => require('./code').GDBCodeModel], internalKey: 'cids:hasCode'},
baseline: {type: GDBMeasureModel, internalKey: 'cids:hasBaseline'}
}, {
rdfTypes: ['cids:Indicator'], name: 'indicator'
});
const GDBIndicatorReportModel = createGraphDBModel({
name: {type: String, internalKey: 'cids:hasName'},
comment: {type: String, internalKey: 'cids:hasComment'},
forOrganization: {type: () => require('./organization').GDBOrganizationModel, internalKey: 'cids:forOrganization'},
forIndicator: {type: () => require('./indicator').GDBIndicatorModel, internalKey: 'cids:forIndicator'},
dateCreated: {type: Date, internalKey: 'schema:dateCreated'},
hasTime: {type: GDBDateTimeIntervalModel, internalKey: 'time:hasTime'},
value: {type: GDBMeasureModel, internalKey: 'iso21972:value'},
}, {
rdfTypes: ['cids:IndicatorReport'], name: 'indicatorReport'
});
const GDBMeasureModel = createGraphDBModel({
numericalValue: {type: String, internalKey: 'iso21972:numerical_value'}
}, {
rdfTypes: ['iso21972:Measure'], name: 'measure'
});
const GDBStakeholderOrganizationModel = createGraphDBModel({
// organization's properties
comment: {type: String, internalKey: 'rdfs:comment'},
hasUsers: {type: [GDBUserAccountModel], internalKey: ':hasUser'},
administrator: {type: GDBUserAccountModel, internalKey: ':hasAdministrator'},
reporters: {type: [GDBUserAccountModel], internalKey: ':hasReporter'},
editors: {type: [GDBUserAccountModel], internalKey: ':hasEditor'},
researchers: {type: [GDBUserAccountModel], internalKey: ':hasResearcher'},
legalName:{type: String, internalKey:'tove_org:hasLegalName'},
hasIds: {type: [GDBOrganizationIdModel], internalKey: 'tove_org:hasID', onDelete: DeleteType.CASCADE},
hasIndicators: {type: [GDBIndicatorModel], internalKey: 'cids:hasIndicator'},
hasOutcomes: {type: [GDBOutcomeModel], internalKey: 'cids:hasOutcome', onDelete: DeleteType.CASCADE},
telephone: {type: GDBPhoneNumberModel, internalKey: 'ic:hasTelephone', onDelete: DeleteType.CASCADE},
contactName: {type: String, internalKey: ':hasContactName'},
email: {type: String, internalKey: ':hasEmail'},
// its own property
description: {type: String, internalKey: 'schema:description'},
catchmentArea: {type: String, internalKey: 'cids:hasCatchmentArea'},
name: {type: String, internalKey: 'genprops:hasName'},
characteristic: {type: () => require("./characteristic").GDBCharacteristicModel, internalKey: 'cids:hasCharacteristic'}
},{
rdfTypes: ['cids:Organization', 'cids:Stakeholder'], name: 'stakeholderOrganization'
})
const GDBOutcomeModel = createGraphDBModel({
name: {type: String, internalKey: 'cids:hasName'}, // todo: here is issue, on protege, it should be tov_org:hasName
description: {type: String, internalKey: 'cids:hasDescription'},
themes: {type: [() => require("./theme").GDBThemeModel], internalKey: 'cids:forTheme'},
stakeholderOutcomes: {type: [() => require("./stakeholderOutcome").GDBStakeholderOutcomeModel], internalKey: 'cids:hasStakeholderOutcome'},
forOrganization: {type: () => require("./organization").GDBOrganizationModel, internalKey: 'cids:forOrganization'},
indicators: {type: [() => require("./indicator").GDBIndicatorModel], internalKey: 'cids:hasIndicator'},
codes: {type: [() => require('./code').GDBCodeModel], internalKey: 'cids:hasCode'}
}, {
rdfTypes: ['cids:Outcome'], name: 'outcome'
});
const GDBOwnershipModel = createGraphDBModel({
resource: {type: Types.NamedIndividual, internalKey: ':hasResource'},
owner: {type: GDBUserAccountModel, internalKey: ':hasOwner'},
modifier: {type: GDBUserAccountModel, internalKey: ':hasModifier'},
dateOfCreation: {type: Date, internalKey: ':dateOfCreation'},
dateOfModified: {type: Date, internalKey: ':dateOfModified'},
}, {
rdfTypes: [':Ownership'], name: 'ownership'
});
const GDBPersonModel = createGraphDBModel({
familyName: {type: String, internalKey: 'foaf:familyName'},
givenName: {type: String, internalKey: 'foaf:givenName'},
middleName: {type: String, internalKey: 'foaf:middleName'},
formalName: {type: String, internalKey: 'foaf:formalName'},
address: {type: GDBAddressModel, internalKey: 'ic:hasAddress'},
gender: {type: String, internalKey: 'cwrc:hasGender'},
email: {type: String, internalKey: 'ic:hasEmail'},
altEmail: {type: String, internalKey: 'ic:hasAltEmail'},
phoneNumber: {type: GDBPhoneNumberModel, internalKey: 'ic:hasTelephone'},
}, {
rdfTypes: ['cids:Person'], name: 'person'
});
const GDBPhoneNumberModel = createGraphDBModel({
areaCode: {type: Number, internalKey: 'ic:hasAreaCode'},
countryCode: {type: Number, internalKey: 'ic:hasCountryCode'},
phoneNumber: {type: Number, internalKey: 'ic:hasPhoneNumber'},
phoneType: {type: Types.NamedIndividual, internalKey: 'ic:hasPhoneType'},
}, {rdfTypes: ['ic:PhoneNumber'], name: 'phoneNumber'});
const GDBStakeholderModel = createGraphDBModel({
// its own property
description: {type: String, internalKey: 'schema:description'},
catchmentArea: {type: String, internalKey: 'cids:hasCatchmentArea'},
name: {type: String, internalKey: 'genprops:hasName'},
characteristic: {type: [() => require("./characteristic").GDBCharacteristicModel], internalKey: 'cids:hasCharacteristic'}
},{
rdfTypes: ['cids:Stakeholder'], name: 'stakeholder'
})
const GDBStakeholderOutcomeModel = createGraphDBModel({
description: {type: String, internalKey: 'cids:hasDescription'},
name: {type: String, internalKey: 'cids:hasName'},
codes : {type: [GDBCodeModel], internalKey: 'cids:hasCode'},
stakeholder: {type: () => require('./stakeholder').GDBStakeholderModel, internalKey: 'cids:forStakeholder'},
outcome: {type: () => require('./outcome').GDBOutcomeModel, internalKey: 'cids:forOutcome'},
importance: {type: String, internalKey: 'cids:hasImportance'},
isUnderserved: {type: Boolean, internalKey: 'cids:isUnderserved'},
indicators: {type: [() => require('./indicator').GDBIndicatorModel], internalKey: 'cids:hasIndicator'},
impactReports: {type: [() => require('./impactReport').GDBImpactReportModel], internalKey: 'cids:hasImpactReport'}
},{
rdfTypes: ['cids:StakeholderOutcome'], name: 'stakeholderOutcome'
})
const GDBThemeModel = createGraphDBModel({
name: {type: String, internalKey: 'cids:hasName'},
description: {type: String, internalKey: 'cids:hasDescription'},
codes: {type: [() => require("./code").GDBCodeModel], internalKey: 'cids:hasCode'}
}, {
rdfTypes: ['cids:Theme'], name: 'theme'
});
const GDBDateTimeIntervalModel = createGraphDBModel({
hasBeginning: {type: GDBInstant, internalKey: 'time:hasBeginning'},
hasEnd: {type: GDBInstant, internalKey: 'time:hasEnd'}
}, {
rdfTypes: ['time:DateTimeInterval'], name: 'dateTimeInterval'
});
const GDBUserAccountModel = createGraphDBModel({
email: {type: String, internalKey: ':hasEmail'},
hash: {type: String, internalKey: ':hasHash'},
salt: {type: String, internalKey: ':hasSalt'},
person: {type: GDBPersonModel, internalKey: 'cids:forPerson', onDelete: DeleteType.CASCADE},
// userType:{type: [Types.NamedIndividual], internalKey: ':userType'},
associatedOrganizations: {type: [() => require('./organization').GDBOrganizationModel], internalKey: ':associatedOrganization'},
isSuperuser: {type: Boolean, internalKey: ':isSuperuser'},
editorOfs: {type: [Types.NamedIndividual], internalKey: ':editorOf'},
reporterOfs: {type: [Types.NamedIndividual], internalKey: ':reporterOf'},
administratorOfs: {type: [Types.NamedIndividual], internalKey: ':administratorOf'},
groupAdminOfs: {type: [Types.NamedIndividual], internalKey: ':groupAdministratorOf'},
researcherOfs: {type: [Types.NamedIndividual], internalKey: ':researcherOf'},
// Exact 3 questions, the answer should be case-insensitive.
securityQuestions: {type: [GDBSecurityQuestion], internalKey: ':hasSecurityQuestion', onDelete: DeleteType.CASCADE}
}, {
rdfTypes: [':User'], name: 'userAccount'
});
© 2023 University of Toronto, CSSE