Ctm 1.0 Tutorial

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Event

    Ctm 1.0 Tutorial - Presentation Transcript

    1. CTM 1.0 Compact Topic Maps Syntax Tutorial Lars Heuer <heuer@semagia.com> TMRA 2008, Leipzig · 15.10.2008
    2. Table of Contents Introduction Overview Details Create your own topic map Questions / Answers © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 2
    3. Introduction CTM is a textual Topic Maps syntax (like LTM and AsTMa=) Is meant to be human-friendly Supports TMDM Standard format (ISO 13250-6) unlike LTM and AsTMa= Human-readable, usable for examples, papers © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 3
    4. Introduction CTM is utilised by TMCL to define constraints CTM will be used by TMQL for INSERT operations UPDATE operations DELETE operations Shares some similarities with TMQL (syntax wise) Current draft (slightly outdated) http://www.isotopicmaps.org/ctm/ © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 4
    5. Introduction CTM is nearly finished (feature-wise, syntax- wise) Next draft will appear within the next two months Currently no stable, upto-date CTM parser is available (should change soon) © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 5
    6. Overview – ToC Topcis Names Occurrences Literals Associations Comments Summary © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 6
    7. Overview – Topics Topics are introduced with an identity and end with a dot (\".\") (often labeled as \"topic block\") Typically topics start with a simple identifier, a subject identifier, or subject locator. john-lennon . # Topic with an item identifier http://en.wikipedia.org/wiki/John_Lennon . # subj. ident. = http://www.google.com/ . # subject locator © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 7
    8. Overview – Topics An IRI is interpreted as subject identifier unless it is prefixed by an equal sign (or it is used as occurrence / variant value) Rootless IRIs (IRIs without \"://\") are not detected, they have to be embedded into \"<\" \">\": Topic with a subject identifier: <mailto:heuer@semagia.com> . © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 8
    9. Overview – Topics Topic statements like names and occurrences are delimited by a semicolon (\";\") The semicolon is optional iff it is the last statement (if the next character is the dot which marks the end of the topic) © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 9
    10. Overview – Names Names are introduced by a hyphen, followed by an optional name type and the value Example: john-lennon - \"John Lennon\"; - surname: \"Lennon\". © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 10
    11. Overview – Names Names are introduced by a hyphen, followed by an optional name type and the value Example: Name value john-lennon - \"John Lennon\"; - surname: \"Lennon\". Name type © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 11
    12. Overview – Names If the name type is not specified, the name uses automatically the default topic name type The name scope is introduced by an @ sign followed by comma delimited themes Example: The-Beatles - \"The Beatles\"; - \"Fab Four\" @nickname; - \"Pilzköpfe\" @nickname, de . © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 12
    13. Overview – Occurrences Occurrences start with the type, a colon followed by the value Example: The-Beatles website: http://www.beatles.com.uk . © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 13
    14. Overview – Occurrence Scope The scope is introduced by an @ sign followed by the themes Example: The-Beatles website: http://www.beatles.com.uk ; website: http://beatles.de/ @de . © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 14
    15. Overview – Literals CTM provides some built-in datatypes: String Date DateTime Integer Decimal IRI These datatypes can be used as occurrence and variant value © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 15
    16. Overview – Literals – String Example: TopicMaps - \"Topic Maps\"; description: \"A technology …\". The datatype of the occurrence \"description\" is set to xsd:string © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 16
    17. Overview – Literals – Dates Examples: McCartney birthday: 1942-02-18. Blog-Entry created: 2008-10-12T17:30:22 . Datatype of \"birthday\" is set to xsd:date, dataype of \"created\" is xsd:dateTime © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 17
    18. Overview – Literals – Numbers Examples: McCartney age: 66 . CTM version: 1.0 . Datatype of \"age\" is set to xsd:integer, dataype of \"version\" is xsd:decimal © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 18
    19. Overview – Literals Non-built-in datatypes can be expressed using the string value with an explicit datatype: \"value\"^^datatype The \"datatype\" is specified by an IRI or a QName Examples: \"09-19\"^^xsd:gMonthDay \"true\"^^http://www.w3.org/2001/XMLSchema# boolean © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 19
    20. Overview – Associations member-of(group: TheBeatles, member: john-lennon) © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 20
    21. Overview – Associations Association type member-of(group: TheBeatles, member: john-lennon) Role types © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 21
    22. Overview – Associations Association type Role players member-of(group: TheBeatles, member: john-lennon) Role types © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 22
    23. Overview – Associations The (optional) scope is added to an association by the @ sign followed by the themes Example: member-of(group: blind-faith, member: eric) @year-1969 © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 23
    24. Overview – Comments Single line comments start with a hash (\"#\") and reach until the end of a line Multiline comments start with #( and end with )# Examples: # I am a single line comment #( line 1 line 2 )# © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 24
    25. Overview – Summary Topics are introduced by an identity and end with a dot (\".\"). The \"topic block\" Topic statements must be delimited by a semicolon (\";\") unless it is the last statement Names are introduced with a hyphen (\"-\"), they have an optional explicit type and a value (string) Occurrences are introduced by the type followed by a literal © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 25
    26. Overview – Summary CTM has built-in literals but the user can specify any datatype using the \"value\"^^datatype notation Notation for associations: assoc-type(role-type1: role-player1, role-type2: role-player2, …) The scope of a statement is introduced by the @ sign followed by comma-delimited themes © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 26
    27. Details – ToC Assigning additional identities to topics Creating type-instance / supertype-subtype relationships Reification Embedded Topics Directives Templates © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 27
    28. Details - Topics Topics are not limited to one identity, any number of identities can be specified Example: McCartney http://en.wikipedia.org/Paul_McCartney ; http://de.wikipedia.org/Paul_McCartney . Topic with the item identifier \"McCartney\" and two subject identifiers © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 28
    29. Details - Topics Example: GoogleWebsite = http://www.google.com/ . Topic with the item identifier \"GoogleWebsite\" and a subject locator © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 29
    30. Details – Type-Instance CTM provides the keyword \"isa\" to establish type-instance relationships between topics Example: john isa person . Creates a type-instance association between \"john\" and \"person\" where \"john\" plays the \"instance\" role and \"person\" plays the \"type\" role © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 30
    31. Details – Supertype-Subtype The keyword \"ako\" creates a supertype- subtype association between topics Example: album ako work . Creates a supertype-subtype association between \"album\" and \"work\" where \"album\" plays the \"subtype\" role and \"work\" plays the \"supertype\" role © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 31
    32. Details – Reification To reify a statment, use a tilde (\"~\") followed by a topic reference Example: works-for(company: BigCo, employee: Barney) ~ barneys-employment barneys-employment descr: \"Barneys employment during 1980\". © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 32
    33. Details – Embedded Topics Everywhere where a topic reference is excpected (i.e. as type) an embedded topic can be used Embedded topics get an automatically generated item identifier It's possible to define additional (stable identities) Handy for reification or where an explicit reference to a topic is not needed © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 33
    34. Details – Embedded Topics Example: works-for(company: BigCo, employee: Barney) ~ [descr: \"Barneys…\"] © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 34
    35. Details – Directives – Prefix The \"%prefix\" directive can be used to assign an IRI to an identifier The identifier can be is used as prefix within a QName Example: %prefix wp http://en.wikipedia.org/ ; wp:John_Lennon – \"John Lennon\". © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 35
    36. Details – Directives – Prefix QNames can also be used for subject locators: %prefix wp http://en.wikipedia.org/ ; = wp:John_Lennon decription: \"Wikipedia page about John Lennon\". © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 36
    37. Details – Directives – Prefix QNames can be used everywhere where a reference to a topic should be made (i.e. as association type, occurrence type, name type etc.) © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 37
    38. Details – Directives – Mergemap The %mergemap directive has the same semantics as the mergemap element in XTM 2.0 (merge the current topic map with the referenced one). In CTM it will be possible to specify the syntax of the referenced file. I.e. it will be possible to merge-in a topic map which is encoded in XTM 2.0, or in LTM etc. This directive will change, current spec is outdated © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 38
    39. Details – Directives – Include %include: The include directive imports the referenced CTM file into the current one. Including a file makes the templates of the other file available in the current one and topics with an equal local identifier (like \"john\") are merged (this would not be the case if the %mergemap directive is used) Prefixes are not imported! © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 39
    40. Details – Directives – Include Example: File A: john – \"John Lennon\". File B: john – surname: \"Lennon\". If file A includes file B the result would be: john – \"John Lennon\"; - surname: \"Lennon\". © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 40
    41. Details – Templates Templates are used to shorten the CTM code Especially useful for facts which occur often in a specific domain Example: def plays-for($player, $group, $instrument) plays(player: $player, group: $group, instrument: $instrument) end McCartney plays-for(The-Beatles, piano). © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 41
    42. Details – Templates If templates are invoked within a topic block, the first argument of the template is the topic! Again: McCartney plays-for(The-Beatles, piano). is translated to: plays-for(McCartney, The-Beatles, piano) If a templates are invoked outside a topic block, all parameters have to be specified: plays-for(McCartney, The-Beatles, piano) © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 42
    43. Details – Templates Since the topic is always used as first argument, it is not possible to invoke a template with no arguments within a topic block Within a template literals and topic references can be replaced with variables © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 43
    44. Details – Templates def born($person, $date, $place) $person isa person; birthday: $date . born-in(person : $person, birthplace : $place). end mccartney born(1942-06-12, Liverpool). © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 44
    45. Details – Templates Result: mccartney isa person; birthday: 1942-06-12 . born-in(person: mccartney, birthplace: Liverpool) © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 45
    46. Details – Templates Don't try to reify something within a template unless the reifier is variable otherwise the CTM processor reports violations of Topic Maps constraints Example (don't do that): def works-for($person, $company) works-for(company: $company, person: $person) ~ employment end Everytime the \"works-for\" template is invoked, the processor tries to reify the newly created association which leads to an error because a topic can reify only one statement © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 46
    47. Details – Templates This works: def works-for($person, $company, $reifier) works-for(company: $company, person: $person) ~ $reifier end © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 47
    48. Details – Templates def is-beatle($beatle) # \"Decorates 'is-member-of' is-member-of($beatle, The-Beatles) end def is-member-of($member, $group) member-of(member: $member, group: $group) end is-member-of(sting, The-Police) is-beatle(john) © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 48
    49. Details – Wildcards ?foo creates an automatically generated item identifier. Everytime the parser sees ?foo again, the same topic will be reused ? creates a topic with an automatically generated item identifier, it is not possible to create a reference to the topic (c.f embedded topics) © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 49
    50. Details – Wildcards Wildcards in templates create a new item identifier for every invokation def tpl() ?foo – \"Foo\". assoc(role-type: ?foo) end tpl(); tpl(); # two topics created from ?foo © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 50
    51. Create your own topic map Think of a music collection, where each album is specified by a PSI which starts with \"http://psi.example.org/album/\" (i.e. http://psi.example.org/album/WhiteAlbum ) Create at least two album topics incl. a name and an occurrence (i.e. a description) Both albums are instances of http://psi.music.com/album\" Create a \"created\" association between a musician or group and the first album (the musician plays the \"creator\" role, the album the \"work\" role) Create a template \"created-by\" for the \"created\" association The second album should use the \"created-by\" template to establish an association between the album and the musician Use QNames where reasonable © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 51
    52. Possible solution %prefix album http://psi.example.org/album/ ; album:WhiteAlbum – \"White Album\"; descr: \"The White Album was one of the last album releases of The Beatles\". The-Beatles – \"The Beatles\". created(creator: The-Beatles, work: album:WhiteAlbum) © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 52
    53. Possible solution def created-by($work, $creator) created(creator: $creator, work: $work) end album:SgtPepper – \"Sgt. Pepper\"; created-by(The-Beatles); descr: \"One of the first concept albums\". © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 53
    54. Discussion Questions? Answers! ☺ © 2008 Lars Heuer · http://www.semagia.com TMRA 2008, Leipzig · 15.10.2008 54

    + tmratmra, 2 years ago

    custom

    512 views, 0 favs, 0 embeds more stats

    CTM is the compact Topic Maps syntax for Topic Maps more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 512
      • 512 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 7
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Groups / Events