Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Tolog Updates


Published on

Describes the update language part of the tolog query language for Topic Maps.

Published in: Technology, Education
  • Dating for everyone is here: ❤❤❤ ❤❤❤
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating direct: ❶❶❶ ❶❶❶
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Tolog Updates

  1. 1. tolog updates<br />TMRA 2009, November 12, Leipzig<br />Lars Marius Garshol, &lt;;<br />
  2. 2. Why an update language?<br />Easier to use than the API<br />empowers new groups of users<br />Potentially better performance than the API<br />Can be embedded in various DSLs<br />Architectural benefits<br />enables JDBC-like API<br />easily accessible over the network<br />
  3. 3. Why one based on tolog?<br />TMQL was not ready at the time<br />in fact, it still isn’t<br />We have a tolog implementation<br />implementing the query part is the biggest job<br />So tolog was the pragmatic choice<br />
  4. 4. What it contains<br />INSERT: add new data to topic map using CTM<br />DELETE: remove data from topic map<br />MERGE: merge objects<br />UPDATE: change existing values<br />
  5. 5. The language<br />
  6. 6. DELETE<br />Static form<br />delete lmg<br />Dynamic form<br />delete $person from instance-of($person, person)<br />
  7. 7. Deletion effects<br />Deleting topic removes<br />from scope<br />from topic types<br />objects typed with<br />as reifier<br />Topic map<br />Topic<br />Name<br />Variant<br />Occurrence<br />Association<br />Role<br />
  8. 8. Delete functions<br />Used for removing values from set properties<br />delete subject-identifier(topic, “”)<br />delete item-identifier(topic, “file://...#tst”)<br />delete subject-locator(topic, “”)<br />Other functions<br />scope($statement, $topic)<br />reifies($reified, $reifier)<br />direct-instance-of($topic, $type)<br />
  9. 9. MERGE<br />Static form<br />MERGE topic1, topic2<br />Dynamic form<br />MERGE $p1, $p2 FROM instance-of($p1, person), instance-of($p2, person), email($p1, $email), email($p2, $email)<br />
  10. 10. INSERT<br />Static form<br />INSERT lmg isa person; - “Lars Marius Garshol” .<br />Dynamic form<br />INSERT tmcl:belongs-to-schema(tmcl:container : $s, tmcl:containee: $c) FROM instance-of($c, tmcl:constraint)<br />
  11. 11. Another INSERT example<br />INSERT $topic $psi . FROM instance-of($topic, $type), instance-of($type, psi-type), topic-name($topic, $name), value($name, $value), str:translate($value, $token, ..., ...), str:concat($psi, “”)<br />
  12. 12. Yet another<br />INSERT event-in-year(event: $e, year: $y) FROM start-date($e, $date), str:substring($y, $date, 4)<br />
  13. 13. Ugliness with INSERT<br />Other statements can use %parameter% syntax<br />in INSERT this is not possible in the CTM part<br />have to say FROM $a = %a% to translate<br />May need to project away variables used in query but not in CTM<br />right now this is done via an implicit projection<br />not clear whether this will confuse users or not<br />
  14. 14. UPDATE<br />Static form<br />UPDATE value(@3421, “New name”)<br />Dynamic form<br />UPDATE value($TN, “Ontopia”) FROM topic-name(oks, $TN)<br />
  15. 15. The UPDATE functions<br />value($object, $string)<br />works on topic name, variant, occurrence<br />resource($object, $string)<br />works on variant and occurrence<br />
  16. 16. Considerations<br />
  17. 17. New API<br />Old API has QueryProcessorIF methods<br />QueryResultIF execute(String)<br />ParsedQueryIF parse(String)<br />New API adds<br />int update(String)<br />ParsedModificationStatementIF parseUpdate(String)<br />also adds ParsedStatementIF as common interface<br />
  18. 18. New access methods<br />Omnigator query plug-in<br />being extended to support updates<br />TMRAP web service<br />being extended with a tolog-update request<br />
  19. 19. A scripting language?<br />Considering to make a language supporting batches of statements<br />that is, running series of modification statements<br />perhaps also setting variables<br />Not clear what features are needed<br />for loops? if? etc<br />
  20. 20. Implementation<br />Mostly straightforward...<br />new classes to represent parsed versions of new statements<br />all reference the class for SELECT statements for their FROM subqueries<br />...except CTM parsing<br />requires two different Antlr parsers (CTM & tolog)<br />had to split the query string in advance, then pass different pieces to different parsers<br />
  21. 21. Concerns<br />Is it expressive enough?<br />just about any modification can be expressed<br />however, it might require many statements<br />Do INSERT statements need “if”?<br />to handle missing values, for example<br />Rules and templates<br />currently, these cannot be defined in modification statements<br />is that a bug? or a feature?<br />
  22. 22. Current status<br />All four statement types implementated<br />Test suite added<br />Some minor nits still need sorting out<br />
  23. 23. Future work<br />Start using the language<br />Write documentation!<br />Hand it over to users<br />See how it goes<br />