semantic modeling - a query language for the 21st century
TRANSCRIPT
![Page 1: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/1.jpg)
SemanticModelingAquerylanguageforthe21stcentury
CliffordHeath
![Page 2: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/2.jpg)
Semantics• Thesharedmeaningsofacommunity
• Expressedinfacts
Here,amodelis:• Standardforcomparison
• Simplifiedrepresentationoftherealworld
• NOTaprototypeormockup
![Page 3: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/3.jpg)
Models must be expressed in a way that allows all parties to understand
and contribute to them
Communicate!
Flickr, mknowles
![Page 4: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/4.jpg)
ActiveFactsproject
• ConstellationQueryLanguage
• ConstellationAPI
• GUIdesigntools
A project of Data Constellation
![Page 5: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/5.jpg)
ElementaryFactsaresimple
e.g.Thispersoniscalled‘John’
![Page 6: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/6.jpg)
Theelementaryformmustbeourcode
•Modelsmustbeexecutable
• Toolsmusthandletheramifications
![Page 7: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/7.jpg)
ActiveFactsGenerators
• CQLorORM2input
• Ruby,SQLoutput
• Later,C#,Java,etc,orwriteyourown
All code you will see in this part is as generated
![Page 8: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/8.jpg)
ORM2Example
This and all other ORM2 examples were created using NORMA, the Neumont ORM2 Architect
![Page 9: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/9.jpg)
CQLandORM2sidebyside
![Page 10: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/10.jpg)
ValueTypes
ORM2:
EachstatementcreatesorimpliestwoValueTypes
![Page 11: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/11.jpg)
EntityTypes
ORM2:
CQL:=
Custom reading:
![Page 12: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/12.jpg)
FactTypes
ORM2:
CQL:
![Page 13: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/13.jpg)
Onetoone
ormoreaccurately:
![Page 14: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/14.jpg)
ObjectifiedFactTypes
ORM2:
CQL:
andthenwecan:
![Page 15: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/15.jpg)
Ternaryandhigher
subset:
![Page 16: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/16.jpg)
CompositeIdentificationORM2:
CQL:
... Two Fact Types, each with 2 readings!
![Page 17: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/17.jpg)
Subtypes,etc
ORM2:
CQL:
(non-identifying supertype)
also: unary fact type, ring constraint, XOR constraint
![Page 18: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/18.jpg)
FactInstancesValueType:
EntityType:
Composite:
...notethejoinoverPerson
...thecontractedformisn’timplementedyet!
JoinContraction:
![Page 19: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/19.jpg)
Subsetconstraints
![Page 20: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/20.jpg)
Mandatory/Exclusive
Mandatoryandexclusive
Alsomandatorynonexclusive,Exclusivenonmandatory
![Page 21: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/21.jpg)
Equivalence
![Page 22: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/22.jpg)
Joinconstraints
“Product”isthesameinstanceinbothclauses
![Page 23: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/23.jpg)
CodeGeneration
![Page 24: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/24.jpg)
FromORMtoCQL
![Page 25: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/25.jpg)
MappingFromFactstoER
• Identifiersdefinekeys
• Decideabsorption using uniqueness
• Compositionmakescompositefacttypes
• Otherconstraintscanbeenforcedtoo
...Halpin
![Page 26: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/26.jpg)
SQLComposition
![Page 27: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/27.jpg)
GeneratedSQLtoday
• Tables
• Columns
• Primarykeys/Uniqueconstraints
• ForeignKeyconstraints
![Page 28: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/28.jpg)
GeneratedSQLcoming
•CHECKconstraints
• Indexesoverviewswhereneeded
• Triggersifnec.
• AutomaticMigration
• evendelayedmigration
![Page 29: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/29.jpg)
GeneratedRuby
![Page 30: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/30.jpg)
![Page 31: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/31.jpg)
RubyAPI
•Usesmetaprogramming
• Relationshipscreatebothmethods
• Implementsmultipleinheritance
• ExcludesReadings(fornow)
![Page 32: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/32.jpg)
Noneedtogeneratethecode
•Simply‘require’theCQL
• ActiveFactsgeneratesandeval’sRuby
•Openclassesallowyoutoextendthem
•Noneedtoeditgeneratedcode
![Page 33: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/33.jpg)
APIDocumentation
• EveryRolehasamethod
•ORM2diagramisAPIdocumentation
• Couldalsogeneratedocumentation
![Page 34: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/34.jpg)
<DogFood>
![Page 35: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/35.jpg)
![Page 36: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/36.jpg)
ActiveFacts uses its generated Ruby metamodel code
![Page 37: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/37.jpg)
Programmingand
Persistence
![Page 38: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/38.jpg)
ConstellationAPI
• Constellationisapopulationoffactinstancesoveravocabulary
![Page 39: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/39.jpg)
ConstellationAPI
•AVocabularyisaRubymodule
• Everyconceptisaclass
• Everyinstanceisofaconcept(norawvalues)
• Noduplicateinstances
• Fullycrossreferenced
• Nonew()justassert/deny
![Page 40: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/40.jpg)
•Onequeryforeachuseraction
• Eachqueryyieldsaconstellation
• Assert/denyanyfacts,then
•Onesave()
• Constraintenforcement
• Changesgetsavedtransactionally
Persistence(notimplementedyet)
![Page 41: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/41.jpg)
Queries(workinprogress)
![Page 42: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/42.jpg)
SimpleQuery
PersonhasgivenName‘Daniel’?
![Page 43: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/43.jpg)
DerivingFactTypes
familyNamecontrolsCompany:PersondirectsCompany,PersonhasfamilyName;
familyNamecontrolsCompany‘Acme,Inc’?familyNamecontrolsCompany?familyName‘Heath’controlsCompany?
![Page 44: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/44.jpg)
Querynesting
• Aquerycaninvokederivedfacttypes
• Subqueriesreturndistinctinstances(handlesSQL’sDISTINCTandGROUPBY)
• AggregationfunctionsasperSQL
• Goal:morepowerthanSQLSELECT
![Page 45: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/45.jpg)
“returning”
familyNamecontrolsCompany:PersondirectsCompany,PersonhasfamilyName,returningPerson,byCompany;
• “returning”makesPerson.given_nameavailable• “returningby”appliessorting• InnerjoinsemanticsapplyiffamilyNameisunknown
![Page 46: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/46.jpg)
“returning”istransitive
normalstuffforPerson:maybePersonwasbornonbirthDate,maybePersonisEmployee,EmployeehasEmployeeNr,returningbirthDate,EmployeeNr;
PersoniscalledfamilyName‘Smith’,normalstuffforPerson?
![Page 47: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/47.jpg)
Transitivequeries
EmployeeworksunderManager:EmployeeissupervisedbyManager[transitive];
EmployeeworksunderManager473?
![Page 48: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/48.jpg)
either/or
familyNameisassociatedwithCompany:Person(asDirector)directsCompanyorPersonworksatCompany,
PersonhasfamilyName;
![Page 49: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/49.jpg)
Units
largePane:PanehasArea,Area>=5foot^2;
WidthandHeightmaybestoredinmillimetres!
PanehasArea:PaneofglasshasWidth,PaneofglasshasHeight,Width*Height=Area;
largePane?
![Page 50: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/50.jpg)
DateandTime
Personisadult:PersonwasbornonbirthDate,birthDate<Now18years,returningbirthDate;
future:“PersonwasbornonbirthDatebefore18yearsago”
![Page 51: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/51.jpg)
Futurework
• APIPersistenceandDBMSadapters
• Queries,includingdragdropGUI
• Unitssupport
• Otherlanguages(naturalandcomputer)
• APRIMO,awebhostedsemanticdesigner
• Reverseengineering
• Automaticmigration
![Page 52: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/52.jpg)
DemonstrationsandQuestions
![Page 53: Semantic Modeling - A Query Language for the 21st century](https://reader033.vdocuments.mx/reader033/viewer/2022053020/559d15c71a28abdf018b47c8/html5/thumbnails/53.jpg)
CliffordHeathAvailableforconsultingandtraining
http://dataconstellation.com/