Compact Topic Maps Syntax - Use Case Solutions ============================================== For these use case solutions the current CTM draft dated 2008-05-15 is used. 3.2.1. Topic with an Item Identifier ----------------------------------- john. 3.2.2. Typed Topic - Using Item Identifiers ------------------------------------------- john isa person. 3.2.3. Typed Topic - Using Subject Identifiers ---------------------------------------------- john isa http://psi.example.org/music/guitarist. Alternative (using the "prefix" directive): %prefix music http://psi.example.org/music/ john isa music:guitarist. 3.2.4. Multityped Topic - Using Item Identifiers ------------------------------------------------ john isa singer; isa guitarist. 3.2.5. Multityped Topic - Using Subject Identifiers --------------------------------------------------- http://psi.example.org/beatles/john isa singer; isa guitarist. 3.3.1. Topic with an Item Identifier and Topic Name --------------------------------------------------- john - "John Lennon". 3.3.2. Topic with a Subject Identifier and Topic Name ----------------------------------------------------- %prefix beatles http://psi.beatles.example.org/ beatles:The_Beatles - "The Beatles". 3.3.3. Topic with a Subject Locator and a Topic Name ---------------------------------------------------- = http://beatles.com/ - "Official website of The Beatles". 3.3.4. Typed Topic Name - Using Item Identifiers ------------------------------------------------ john - fullname: "John Ono Lennon". 3.3.5. Typed Topic Names - Using Subject Identifiers ---------------------------------------------------- john - http://psi.example.org/fullname: "John Ono Lennon". 3.3.6. Scoped Topic Name - Using Item Identifiers ------------------------------------------------- john - "John Ono Lennon" @fullname. 3.3.7. Scoped Topic Name - Using Subject Itentifiers ---------------------------------------------------- %prefix ex http://blabla.org john - "John Ono Lennon" @ex:fullname. 3.3.8. Multi Scoped Topic Name ------------------------------ beatles - "The Beatles"; - "Fab Four" @nickname short . 3.3.9. Typed and Scoped Names ----------------------------- john - fullname: "John Ono Lennon" @yoko. 3.3.10. Topic Name with Variant of datatype String -------------------------------------------------- john - "John Lennon" ("lennon, john" @tm:sort). 3.3.11. Topic Name with Variant of datatype XML ----------------------------------------------- john - "John Lennon" ( "John Lennon"^^xsd:anyType @markup). 3.3.12. Topic Name with Variant of datatype URI ----------------------------------------------- john - "John Lennon" (http://link/to/an/image.jpg @image). 3.3.13. Topic Name with Variant with non-TMDM datatype ------------------------------------------------------ revolution-nine - "Revolution No. 9" (9 @number). 3.3.14 Typed topic with subject identifier with occurrences and associations ---------------------------------------------------------------------------- # Creating the templates def has-shoesize($person, $size) $person shoesize: $size. # Shoesize is modelled as occurrence end def is-member-of($member, $group) is-member-of(member: $member, group: $group) end http://psi.example.org/beatles/paul isa person; has-shoesize(45); is-member-of(the-beatles); homepage: http://www.paulmccartney.com/ . 3.4.2. Typed Occurrence of datatype String - Using Item Identifiers ------------------------------------------------------------------- a-day-in-the-life lyrics: "I read ...". 3.4.3. Typed Occurrence of datatype String - Using Subject Identifiers ---------------------------------------------------------------------- %prefix ex http://www.blabla.org a-day-in-the-life ex:lyrics: "I read ...". 3.4.4. Scoped Occurrence of datatype String - Using Item Identifiers -------------------------------------------------------------------- a-day-in-the-life lyrics: "I read ..." @en. 3.4.5. Scoped Occurrence of datatype String - Using Subject Identifiers ----------------------------------------------------------------------- %prefix ex http://bla.org %prefix lang http://language.org a-day-in-the-life ex:lyrics: "I read ..." @lang:en. 3.4.6. Occurrence of datatype XML --------------------------------- a-day-in-the-life lyrics: """ [...] [...] """^^xsd:anyType. 3.4.7. Occurrence of datatype IRI --------------------------------- beatles website: http://www.beatles.com/. or beatles website: "http://www.beatles.com/"^^xsd:anyURI. 3.4.7. Occurrence of non-TMDM datatype -------------------------------------- pennylane track-number: 2. or pennylane track-number: "2"^^xsd:integer. 3.5.1. Creating Associations ---------------------------- created(person : mccartney, song : yesterday) or with templates: # Template definition def created($creator, $song) created(person : $creator, song : $song) end mccartney created(yesterday). or with template invocation outside of topic declaration # Template definition def created($creator, $song) created(person : $creator, song : $song) end created(mccartney, yesterday) 3.5.2. Scoped Association ------------------------- created(person : mc-cartney, song : yesterday) @music 3.5.5. Supertype-Subtype relationship - Using Item Identifiers -------------------------------------------------------------- song ako musical-work. 3.5.6. Supertype-Subtype relationship - Using Subject Identifiers ----------------------------------------------------------------- %prefix ex http://... ex:song ako ex:musical-work. 3.6.1 Reification of a Topic Map -------------------------------- ~ [- "Beatlestopicmap"] 3.6.2. Reification of a Topic Name ---------------------------------- john - "John Ono Lennon" ~ name-of-john-lennon. 3.6.3. Reification of a Variant ------------------------------- john - "John Ono Lennon" ("lennon, john" @sort ~ sortname-of-john-lennon). 3.6.4. Reification of an Occurrence ----------------------------------- john website: http://www.lennon.com/ ~ lennons-website. 3.6.5. Reification of an Association ------------------------------------ partnership(person: lennon, person: mc-cartney) ~ lennon-mccartney lennon-mccartney - "Lennon / McCartney". Alternative: partnership(person: lennon, person: mc-cartney) ~ [- "Lennon / McCartney"] 3.7.1. Singe line comment ------------------------- # a single line with comments 3.7.2. Multiline comment ------------------------ #( one comment line 2 )#