Successfully reported this slideshow.

Semantic Modeling - A Query Language for the 21st century

1,263 views

Published on

Published in: Technology
  • Be the first to comment

Semantic Modeling - A Query Language for the 21st century

  1. 1. Semantic
Modeling A
query
language
for
the
21st
century Clifford
Heath
  2. 2. Semantics • The
shared
meanings
of
a
community • Expressed
in
facts Here,
a
model
is: • Standard
for
comparison • Simplified
representation
of
 the
real
world • NOT
a
prototype
or
mockup
  3. 3. Communicate! Models must be expressed in a way that allows all parties to understand and contribute to them Flickr, mknowles
  4. 4. ActiveFacts
project A project of Data Constellation • Constellation
Query
Language • Constellation
API • GUI
design
tools
  5. 5. Elementary
Facts
are
simple e.g.
This
person
is
called
‘John’
  6. 6. The
elementary
form must
be
our
code • Models
must
be
executable • Tools
must
handle
the
ramifications
  7. 7. ActiveFacts
Generators • CQL
or
ORM2
input • Ruby,
SQL
output • Later,
C#,
Java,
etc,
or
write
your
own All code you will see in this part is as generated
  8. 8. ORM2
Example This and all other ORM2 examples were created using NORMA, the Neumont ORM2 Architect
  9. 9. CQL
and
ORM2 side
by
side
  10. 10. Value
Types ORM2: Each
statement
creates
or
implies
two
ValueTypes
  11. 11. Entity
Types ORM2: CQL: = Custom reading:
  12. 12. Fact
Types ORM2: CQL:
  13. 13. One­to­one or
more
accurately:
  14. 14. Objectified
Fact
Types ORM2: CQL: and
then
we
can:
  15. 15. Ternary
and
higher subset:
  16. 16. Composite
Identification ORM2: CQL: ... Two Fact Types, each with 2 readings!
  17. 17. Subtypes,
etc (non-identifying supertype) ORM2: CQL: also: unary fact type, ring constraint, XOR constraint
  18. 18. Fact
Instances Value
Type: Entity
Type: Composite: ...
note
the
join
over
Person Join
Contraction: ...
the
contracted
form
isn’t
implemented
yet!
  19. 19. Subset
constraints
  20. 20. Mandatory
/
Exclusive Mandatory
and
exclusive Also
mandatory
non­exclusive, Exclusive
non­mandatory
  21. 21. Equivalence
  22. 22. Join
constraints “Product”
is
the
same
instance
in
both
clauses
  23. 23. Code
Generation
  24. 24. From 
ORM
to
CQL
  25. 25. Mapping
From
Facts
to
ER ...Halpin • Identifiers
define
keys • Decide
absorption using uniqueness • Composition
­
makes
composite
fact
types • Other
constraints
can
be
enforced
too
  26. 26. SQL
Composition
  27. 27. Generated
SQL
­
today • Tables • Columns • Primary
keys
/
Unique
constraints • Foreign
Key
constraints
  28. 28. Generated
SQL
­
coming • CHECK
constraints • Indexes
over
views
where
needed • Triggers
if
nec. • Automatic
Migration • even
delayed
migration
  29. 29. Generated
Ruby
  30. 30. Ruby
API • Uses
meta
programming • Relationships
create
both
methods • Implements
multiple
inheritance • Excludes
Readings
(for
now)
  31. 31. No
need
to
 generate
the
code • Simply
‘require’
the
CQL • ActiveFacts
generates
and
eval’s
Ruby • Open
classes
allow
you
to
extend
them • No
need
to
edit
generated
code
  32. 32. API
Documentation • Every
Role
has
a
method • ORM2
diagram
is
API
documentation • Could
also
generate
documentation
  33. 33. <DogFood>
  34. 34. ActiveFacts uses its generated Ruby metamodel code
  35. 35. Programming and Persistence
  36. 36. Constellation
API • Constellation
is
a
population
of
 fact
instances
over
a
vocabulary
  37. 37. Constellation
API • A
Vocabulary
is
a
Ruby
module • Every
concept
is
a
class • Every
instance
is
of
a
concept 

(no
raw
values) • No
duplicate
instances • Fully
cross­referenced • No
new()
­
just
assert
/
deny
  38. 38. Persistence
 (not
implemented
yet) • One
query
for
each
user
action • Each
query
yields
a
constellation • Assert/deny
any
facts,
then • One
save() • Constraint
enforcement • Changes
get
saved
transactionally
  39. 39. Queries (work
in
progress)
  40. 40. Simple
Query Person
has
given­Name
‘Daniel’?
  41. 41. Deriving
Fact
Types family­Name
controls
Company
: Person
directs
Company, Person
has
family
Name; family
Name
controls
Company
‘Acme,
Inc’? family
Name
controls
Company? family
Name
‘Heath’
controls
Company?
  42. 42. Query
nesting • A
query
can
invoke
derived
fact
types • Sub­queries
return
distinct
instances (handles
SQL’s
DISTINCT

and
GROUP
BY) • Aggregation
functions
as
per
SQL • Goal:
more
power
than
SQL
SELECT
  43. 43. “returning” family
Name
controls
Company
: Person
directs
Company, Person
has
family
Name, returning
Person, by
Company; • “returning”
makes
Person.given_name
available • “returning
by”
applies
sorting • Inner
join
semantics
apply
if
family
Name
is
unknown
  44. 44. “returning”
is
transitive normal
stuff
for
Person: maybe
Person
was
born
on
birth
Date, maybe
Person
is
Employee, Employee
has
EmployeeNr, returning
birth
Date,
EmployeeNr; Person
is
called
family­Name
‘Smith’, normal
stuff
for
Person?
  45. 45. Transitive
queries Employee
works
under
Manager
: Employee
is
supervised
by
Manager
[transitive]; Employee
works
under
Manager
473?
  46. 46. either/or family
Name
is
associated
with
Company
: Person
(as
Director)
directs
Company
or Person
works
at
Company, Person
has
family
Name;
  47. 47. Units Pane
has
Area: Pane
of
glass
has
Width, Pane
of
glass
has
Height, Width
*
Height
=
Area; large
Pane: Pane
has
Area,
Area
>=
5
foot^2; large
Pane? Width
and
Height
may
be
stored
in
millimetres!
  48. 48. Date
and
Time Person
is
adult: Person
was
born
on
birth
Date, birth
Date
<
Now
­
18
years, returning
birth
Date; future:
“Person
was
born
on
birth
Date
before
18
years
ago”
  49. 49. Future
work • API
Persistence
and
DBMS
adapters • Queries,
including
drag­drop
GUI • Units
support • Other
languages
(natural
and
computer) • APRIMO,
a
web­hosted
semantic
designer • Reverse
engineering • Automatic
migration
  50. 50. Demonstrations and
Questions
  51. 51. Clifford
Heath Available
for
consulting
and
training http://dataconstellation.com/

×