#!/home/marcel/Languages/Perl6/Projects/Semi-xml/bin/sxml2xml.pl6
#
---
output/filepath:                .;
output/program/cat:             | cat > topicmap.xml;
output/program/xml:             | xmllint --format - > topicmap.xml;
output/program/chk:
        | xmllint --format --schema /home/marcel/Languages/Perl6/Projects/Topicmap/doc/TopicMap/topicmap.schema -
        ;

---
$topicMap version=2.0
	  xmlns=http://www.topicmaps.org/xtm/
	  xmlns:xsd=http://www.w3.org/2001/XMLSchema-datatypes
          [

  $!SxmlCore.comment [
    'Subject indicator' is the object in the real world.
    'subject identifier' points to 'Subject indicator'. ISBN or pasport number.
    'subject locator' information resource that IS the subject of of the topic.
    'id' used to refer to
  ]
  
  $topic id=language [ ]
  
  $topic id=en [
    $instanceOf [ $topicRef href='#language' [ ] ]
    $name [
      $value [ english language ]
    ]
  ]
  
  $topic id=nl [
    $instanceOf [ $topicRef href='#language' [ ] ]
    $name [
      $value [ dutch language ]
      $itemIdentity href=profession [ ]
    ]
  ]
  
  $mergeMap href=name-list.stm [ ]

  $topic id=profession [
    $name [
      $value [ type of work to earn money ]
      $scope [
        $topicRef href='name-list.stm#man' [ ]
        $topicRef href='name-list.stm#woman' [ ]
      ]
      
      $variant [
        $scope [
          $topicRef href='#nl' [ ]
        ]

        $resourceData datatype=text [
          type werk om je geld te verdienen
        ]
      ]
    ]
  ]

  $topic id=honorable-profession [
    $instanceOf [ $topicRef href='#profession' [ ] ]
    $name [
      $type [ $topicRef href='doc/TopicMap/topicmap.sxml#profession' [ ] ]
      $value [ specialized profession ]
    ]
  ]
  
  $topic id='queen of england' [
    $instanceOf [ $topicRef href='#profession' [ ] ]
  ]

  $topic id=elisabeth [
    $instanceOf [ $topicRef href='#queen%20of%20england' [ ] ]
    $name reifier='#history' [
      $type [ $topicRef href='#honorable-profession' [ ] ]
      $value [ queen of england ]
    ]
    
    $occurrence reifier='#history' [
      $type [ $topicRef href='#crowning' [ ] ]
      $resourceRef href='#date' [ ]
    ]
  ]
  
  $topic id=date [ $name [ $value [1947-02-16] ] ]
  $topic id=history [ $name [ $value [dates of crownings] ] ]
  $topic id=crowning [ $name [ $value [act of becoming royal] ] ]
]
