when_exe 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +333 -212
 - data/bin/make_ttl.rb +37 -0
 - data/bin/make_ttl.rb.config +9 -0
 - data/lib/when_exe.rb +923 -925
 - data/lib/when_exe/calendarnote.rb +9 -5
 - data/lib/when_exe/coordinates.rb +2437 -2446
 - data/lib/when_exe/inspect.rb +1480 -1408
 - data/lib/when_exe/linkeddata.rb +574 -0
 - data/lib/when_exe/locales/akt.rb +177 -176
 - data/lib/when_exe/locales/locale.rb +751 -751
 - data/lib/when_exe/mini_application.rb +307 -307
 - data/lib/when_exe/parts/resource.rb +1115 -1103
 - data/lib/when_exe/region/chinese/epochs.rb +6 -5
 - data/lib/when_exe/region/christian.rb +831 -829
 - data/lib/when_exe/region/japanese.rb +93 -93
 - data/lib/when_exe/region/japanese/notes.rb +1510 -1495
 - data/lib/when_exe/region/japanese/residues.rb +13 -13
 - data/lib/when_exe/tmposition.rb +2307 -2273
 - data/lib/when_exe/tmreference.rb +1744 -1734
 - data/lib/when_exe/version.rb +2 -2
 - data/link_to_online_documents +1 -1
 - data/test/scripts/3.ext.rb +6 -6
 - data/test/scripts/3.rb +6 -6
 - data/test/test.rb +76 -75
 - data/test/test/icalendar.rb +883 -879
 - data/test/test/linkeddata.rb +224 -0
 - data/test/test/region/m17n.rb +193 -193
 - data/when_exe.gemspec +3 -2
 - metadata +13 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 21ef2902a6f6e66f6b217b300ec63d0cfe4b3ec1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e132d01708f7eaac9e2246faeec19b5843551422
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 1622bb678b6adfce5e1c54a91889ede8bb675fa3add66a01eba031910bbc3f11e45c2cbb5c4b24ac46bd22a9d3984d30f621f6e5c1e67d5430ca7d7cd4b142c3
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 09f2ceda494e0e731593468051147ec22845827847a0f35f75ab9ca8b3969a6ea3154d8b5becc01ff80e302a30649b29a424cd34b86d804a2646a3b807f0dd36
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,212 +1,333 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            when_exe - A multicultural and multilingualized calendar library
         
     | 
| 
       2 
     | 
    
         
            -
            ================================================================
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            [](http://badge.fury.io/rb/when_exe)
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            [when_exe](http://rubygems.org/gems/when_exe) is a multicultural and multilingualized calendar library based on [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601), [ISO 19108](http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=26013), [RFC 5545(iCalendar)](http://tools.ietf.org/html/rfc5545) and [RFC6350](http://tools.ietf.org/html/rfc6350).
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            [<img alt='Architecture' title='display this figure at actual size' src='https://raw.githubusercontent.com/suchowan/when_exe/f7bb8b51259f0c1653c6c37b3ce20bd2a6ab7914/architecture.png' width='637' height='408'/>](https://raw.githubusercontent.com/suchowan/when_exe/f7bb8b51259f0c1653c6c37b3ce20bd2a6ab7914/architecture.png)
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            Installation
         
     | 
| 
       11 
     | 
    
         
            -
            ------------
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
            The when_exe gem can be installed by running:
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                gem install when_exe
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            Web Server
         
     | 
| 
       19 
     | 
    
         
            -
            ----------
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
            Web server for when_exe demonstration is available on [hosi.org](http://hosi.org).
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            You can see examples of [When.exe Standard Representation](http://www.asahi-net.or.jp/~dd6t-sg/when_rdoc/when_en.html#label-8) and Reference System IRI at the top-left corner of Date frame.
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
            Preferences are changeable on [hosi.org/cookies](http://hosi.org/cookies).
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
            Available  
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
                 
     | 
| 
       62 
     | 
    
         
            -
                 
     | 
| 
       63 
     | 
    
         
            -
                 
     | 
| 
       64 
     | 
    
         
            -
                 
     | 
| 
       65 
     | 
    
         
            -
                 
     | 
| 
       66 
     | 
    
         
            -
                 
     | 
| 
       67 
     | 
    
         
            -
                 
     | 
| 
       68 
     | 
    
         
            -
                 
     | 
| 
       69 
     | 
    
         
            -
                 
     | 
| 
       70 
     | 
    
         
            -
                p gregorian_date. 
     | 
| 
       71 
     | 
    
         
            -
                p gregorian_date. 
     | 
| 
       72 
     | 
    
         
            -
                p  
     | 
| 
       73 
     | 
    
         
            -
                
         
     | 
| 
       74 
     | 
    
         
            -
                 
     | 
| 
       75 
     | 
    
         
            -
                 
     | 
| 
       76 
     | 
    
         
            -
                 
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
                p  
     | 
| 
       79 
     | 
    
         
            -
                p  
     | 
| 
       80 
     | 
    
         
            -
                 
     | 
| 
       81 
     | 
    
         
            -
                 
     | 
| 
       82 
     | 
    
         
            -
                
         
     | 
| 
       83 
     | 
    
         
            -
                 
     | 
| 
       84 
     | 
    
         
            -
                
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
                p  
     | 
| 
       87 
     | 
    
         
            -
                p  
     | 
| 
       88 
     | 
    
         
            -
                 
     | 
| 
       89 
     | 
    
         
            -
                 
     | 
| 
       90 
     | 
    
         
            -
                 
     | 
| 
       91 
     | 
    
         
            -
                 
     | 
| 
       92 
     | 
    
         
            -
                 
     | 
| 
       93 
     | 
    
         
            -
                 
     | 
| 
       94 
     | 
    
         
            -
                
         
     | 
| 
       95 
     | 
    
         
            -
                 
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
                p gregorian_date 
     | 
| 
       98 
     | 
    
         
            -
                p gregorian_date. 
     | 
| 
       99 
     | 
    
         
            -
                p gregorian_date. 
     | 
| 
       100 
     | 
    
         
            -
                p gregorian_date. 
     | 
| 
       101 
     | 
    
         
            -
                
         
     | 
| 
       102 
     | 
    
         
            -
                 
     | 
| 
       103 
     | 
    
         
            -
                 
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
                p  
     | 
| 
       106 
     | 
    
         
            -
                p  
     | 
| 
       107 
     | 
    
         
            -
                p  
     | 
| 
       108 
     | 
    
         
            -
                p  
     | 
| 
       109 
     | 
    
         
            -
                
         
     | 
| 
       110 
     | 
    
         
            -
                 
     | 
| 
       111 
     | 
    
         
            -
                
         
     | 
| 
       112 
     | 
    
         
            -
                 
     | 
| 
       113 
     | 
    
         
            -
                p  
     | 
| 
       114 
     | 
    
         
            -
                p  
     | 
| 
       115 
     | 
    
         
            -
                p  
     | 
| 
       116 
     | 
    
         
            -
                p  
     | 
| 
       117 
     | 
    
         
            -
                 
     | 
| 
       118 
     | 
    
         
            -
                 
     | 
| 
       119 
     | 
    
         
            -
                 
     | 
| 
       120 
     | 
    
         
            -
                 
     | 
| 
       121 
     | 
    
         
            -
                
         
     | 
| 
       122 
     | 
    
         
            -
                 
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
                 
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
                
         
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
       137 
     | 
    
         
            -
             
     | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
       145 
     | 
    
         
            -
             
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
                   # 
     | 
| 
       148 
     | 
    
         
            -
                   #  " 
     | 
| 
       149 
     | 
    
         
            -
                   #  " 
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
       152 
     | 
    
         
            -
                 
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
             
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
             
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
                 
     | 
| 
       160 
     | 
    
         
            -
                 
     | 
| 
       161 
     | 
    
         
            -
                
         
     | 
| 
       162 
     | 
    
         
            -
             
     | 
| 
       163 
     | 
    
         
            -
                 
     | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
       166 
     | 
    
         
            -
             
     | 
| 
       167 
     | 
    
         
            -
                 
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
       170 
     | 
    
         
            -
                
         
     | 
| 
       171 
     | 
    
         
            -
                 
     | 
| 
       172 
     | 
    
         
            -
                 
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
                
         
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
             
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
       186 
     | 
    
         
            -
             
     | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
       188 
     | 
    
         
            -
             
     | 
| 
       189 
     | 
    
         
            -
             
     | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
             
     | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
       194 
     | 
    
         
            -
             
     | 
| 
       195 
     | 
    
         
            -
             
     | 
| 
       196 
     | 
    
         
            -
             
     | 
| 
       197 
     | 
    
         
            -
             
     | 
| 
       198 
     | 
    
         
            -
             
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
       202 
     | 
    
         
            -
             
     | 
| 
       203 
     | 
    
         
            -
             
     | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
             
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            when_exe - A multicultural and multilingualized calendar library
         
     | 
| 
      
 2 
     | 
    
         
            +
            ================================================================
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            [](http://badge.fury.io/rb/when_exe)
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            [when_exe](http://rubygems.org/gems/when_exe) is a multicultural and multilingualized calendar library based on [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601), [ISO 19108](http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=26013), [RFC 5545(iCalendar)](http://tools.ietf.org/html/rfc5545) and [RFC6350](http://tools.ietf.org/html/rfc6350). JSON-LD format for TemporalPosition and TemporalReferenceSystem are available.
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            [<img alt='Architecture' title='display this figure at actual size' src='https://raw.githubusercontent.com/suchowan/when_exe/f7bb8b51259f0c1653c6c37b3ce20bd2a6ab7914/architecture.png' width='637' height='408'/>](https://raw.githubusercontent.com/suchowan/when_exe/f7bb8b51259f0c1653c6c37b3ce20bd2a6ab7914/architecture.png)
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            Installation
         
     | 
| 
      
 11 
     | 
    
         
            +
            ------------
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            The when_exe gem can be installed by running:
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                gem install when_exe
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            Web Server
         
     | 
| 
      
 19 
     | 
    
         
            +
            ----------
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            Web server for when_exe demonstration is available on [hosi.org](http://hosi.org) ( or mirror site [hosi-org.herokuapp.com](http://hosi-org.herokuapp.com) ).
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            You can see examples of [When.exe Standard Representation](http://www.asahi-net.or.jp/~dd6t-sg/when_rdoc/when_en.html#label-8) and Reference System IRI at the top-left corner of Date frame.
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            Preferences are changeable on [hosi.org/cookies](http://hosi.org/cookies).
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            SPARQL endpoint is [hosi.org/japan/sparql](http://hosi.org/japan/sparql).
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            Documentation
         
     | 
| 
      
 31 
     | 
    
         
            +
            -------------
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            API documentation for when_exe is available on [RubyDoc.info](http://rubydoc.info/gems/when_exe) or [here](http://www2u.biglobe.ne.jp/~suchowan/when_exe/frames.html).
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            Available calendars and clocks are defined as subclasses of TM_Calendar and TM_Clock or using definition tables in [CalendarTypes namespace](http://rubydoc.info/gems/when_exe/When/CalendarTypes).
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            Available calendar eras are defined using definition tables in [CalendarEra namespace](http://rubydoc.info/gems/when_exe/When/TM/CalendarEra).
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            Whole TemporalReferenceSystem resources are listed in the [Resource Dictionary](http://www2u.biglobe.ne.jp/~suchowan/ResourceDictionary.html).
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            For further detail, please refer to the [when_exe Wiki](http://www2u.biglobe.ne.jp/~suchowan/when_exe_wiki.html) pages.
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            License
         
     | 
| 
      
 45 
     | 
    
         
            +
            -------
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            This beta version's license is limited. Please see [LICENSE.txt](https://github.com/suchowan/when_exe/blob/master/LICENSE.txt) for details.
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            Data sets [TemporalPositionDataSet](http://hosi.org/tp.rdf) and [TemporalReferenceSystemDataSet](http://hosi.org/When.rdf) should be used according to [CC-BY-ND](http://creativecommons.org/licenses/by-nd/4.0/) license.
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            Source Code
         
     | 
| 
      
 53 
     | 
    
         
            +
            -----------
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            Source code for when_exe is available on [GitHub](https://github.com/suchowan/when_exe).
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            Example Usage
         
     | 
| 
      
 59 
     | 
    
         
            +
            -------------
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                require 'when_exe'
         
     | 
| 
      
 62 
     | 
    
         
            +
                # include When
         
     | 
| 
      
 63 
     | 
    
         
            +
                
         
     | 
| 
      
 64 
     | 
    
         
            +
                # When::TM::CalDate ---------------------------
         
     | 
| 
      
 65 
     | 
    
         
            +
                
         
     | 
| 
      
 66 
     | 
    
         
            +
                gregorian_date = When.tm_pos(2014, 8, 1)
         
     | 
| 
      
 67 
     | 
    
         
            +
                p gregorian_date                             #=> 2014-08-01
         
     | 
| 
      
 68 
     | 
    
         
            +
                p When.when?('2014-08-01')                   #=> 2014-08-01, the same date
         
     | 
| 
      
 69 
     | 
    
         
            +
                p gregorian_date.to_i                        #=> 2456871, Julian Day Number(Integer)
         
     | 
| 
      
 70 
     | 
    
         
            +
                p gregorian_date.to_f                        #=> 2456871.0, at noon for UTC
         
     | 
| 
      
 71 
     | 
    
         
            +
                p gregorian_date.class                       #=> When::TM::CalDate
         
     | 
| 
      
 72 
     | 
    
         
            +
                p gregorian_date.frame.iri                   #=> "http://hosi.org/When/CalendarTypes/Gregorian"
         
     | 
| 
      
 73 
     | 
    
         
            +
                puts gregorian_date.name(When::MONTH).class  #=> When::BasicTypes::M17n
         
     | 
| 
      
 74 
     | 
    
         
            +
                puts gregorian_date.name(When::MONTH).iri    #=> http://hosi.org/When/BasicTypes/M17n/Calendar::Month::August
         
     | 
| 
      
 75 
     | 
    
         
            +
                puts gregorian_date.name(When::MONTH) / 'en' #=> August
         
     | 
| 
      
 76 
     | 
    
         
            +
                puts gregorian_date.name(When::MONTH) / 'fr' #=> août
         
     | 
| 
      
 77 
     | 
    
         
            +
                puts gregorian_date.name(When::MONTH) / 'ar' #=> اغسطس
         
     | 
| 
      
 78 
     | 
    
         
            +
                p gregorian_date.easter                      #=> 2014-04-20
         
     | 
| 
      
 79 
     | 
    
         
            +
                p gregorian_date.is?('Easter')               #=> false
         
     | 
| 
      
 80 
     | 
    
         
            +
                p When.tm_pos(2014, 4, 20).is?('Easter')     #=> true
         
     | 
| 
      
 81 
     | 
    
         
            +
                
         
     | 
| 
      
 82 
     | 
    
         
            +
                islamic_date = When::TabularIslamic ^ gregorian_date
         
     | 
| 
      
 83 
     | 
    
         
            +
                p islamic_date                               #=> 1435-10-04
         
     | 
| 
      
 84 
     | 
    
         
            +
                p When.tm_pos(1435, 10, 4, :frame=>'TabularIslamic')
         
     | 
| 
      
 85 
     | 
    
         
            +
                                                             #=> 1435-10-04, the same date
         
     | 
| 
      
 86 
     | 
    
         
            +
                p When.when?('1435-10-4^TabularIslamic')     #=> 1435-10-04, the same date
         
     | 
| 
      
 87 
     | 
    
         
            +
                p islamic_date.frame.iri                     #=> "http://hosi.org/When/CalendarTypes/TabularIslamic"
         
     | 
| 
      
 88 
     | 
    
         
            +
                puts islamic_date.name(When::MONTH) / 'en'   #=> Shawwal
         
     | 
| 
      
 89 
     | 
    
         
            +
                puts islamic_date.name(When::MONTH) / 'ar'   #=> شوال
         
     | 
| 
      
 90 
     | 
    
         
            +
                
         
     | 
| 
      
 91 
     | 
    
         
            +
                # When::TM::DateAndTime ------------------------
         
     | 
| 
      
 92 
     | 
    
         
            +
                
         
     | 
| 
      
 93 
     | 
    
         
            +
                gregorian_date = When.tm_pos(2014, 8, 1, 9, 0, 0, :clock=>'+09:00')
         
     | 
| 
      
 94 
     | 
    
         
            +
                p gregorian_date                             #=> 2014-08-01T09:00:00+09:00
         
     | 
| 
      
 95 
     | 
    
         
            +
                p When.when?('2014-08-01T09:00:00+09:00')    #=> 2014-08-01T09:00:00+09:00, the same date
         
     | 
| 
      
 96 
     | 
    
         
            +
                p gregorian_date.to_i                        #=> 2456871, Julian Day Number(Integer)
         
     | 
| 
      
 97 
     | 
    
         
            +
                p gregorian_date.to_f                        #=> 2456870.5 at 09:00:00 of Timezone +09:00
         
     | 
| 
      
 98 
     | 
    
         
            +
                p gregorian_date.class                       #=> When::TM::DateAndTime
         
     | 
| 
      
 99 
     | 
    
         
            +
                p gregorian_date.frame.iri                   #=> "http://hosi.org/When/CalendarTypes/Gregorian"
         
     | 
| 
      
 100 
     | 
    
         
            +
                p gregorian_date.clk_time.class              #=> When::TM::ClockTime
         
     | 
| 
      
 101 
     | 
    
         
            +
                p gregorian_date.clk_time.frame.iri          #=> "http://hosi.org/When/TM/Clock?label=+09:00"
         
     | 
| 
      
 102 
     | 
    
         
            +
                
         
     | 
| 
      
 103 
     | 
    
         
            +
                gregorian_date = When.tm_pos(2014, 8, 1, 9, 0, 0, :clock=>'+09:00',
         
     | 
| 
      
 104 
     | 
    
         
            +
                                                                  :long=>'139.413012E', :lat=>'35.412222N')
         
     | 
| 
      
 105 
     | 
    
         
            +
                p gregorian_date                             #=> 2014-08-01T09:00:00+09:00
         
     | 
| 
      
 106 
     | 
    
         
            +
                p gregorian_date.location.iri                #=> "http://hosi.org/When/Coordinates/Spatial?long=139.413012E&lat=35.412222N&alt=0"
         
     | 
| 
      
 107 
     | 
    
         
            +
                p gregorian_date.sunrise.floor(When::MINUTE) #=> 2014-08-01T04:48+09:00
         
     | 
| 
      
 108 
     | 
    
         
            +
                p gregorian_date.sunset.floor(When::MINUTE)  #=> 2014-08-01T18:46+09:00
         
     | 
| 
      
 109 
     | 
    
         
            +
                
         
     | 
| 
      
 110 
     | 
    
         
            +
                darian_date = When::Darian ^ gregorian_date
         
     | 
| 
      
 111 
     | 
    
         
            +
                p darian_date                                #=> 0216-13-23T15:12:11MTC
         
     | 
| 
      
 112 
     | 
    
         
            +
                p darian_date.to_i                           #=> 49974, Serial Day Number(Integer)
         
     | 
| 
      
 113 
     | 
    
         
            +
                p darian_date.to_f                           #=> 49974.13346485421
         
     | 
| 
      
 114 
     | 
    
         
            +
                p darian_date.frame.iri                      #=> "http://hosi.org/When/CalendarTypes/Darian"
         
     | 
| 
      
 115 
     | 
    
         
            +
                p darian_date.clk_time.frame.iri             #=> "http://hosi.org/When/CalendarTypes/MTC"
         
     | 
| 
      
 116 
     | 
    
         
            +
                p darian_date.time_standard.iri              #=> "http://hosi.org/When/TimeStandard/MartianTimeCoordinated?location=(_l:long=0&datum=Mars)"
         
     | 
| 
      
 117 
     | 
    
         
            +
                
         
     | 
| 
      
 118 
     | 
    
         
            +
                # When::TM::CalendarEra ------------------------
         
     | 
| 
      
 119 
     | 
    
         
            +
                
         
     | 
| 
      
 120 
     | 
    
         
            +
                babylonian_date = When.tm_pos('NebuchadnezzarII', 1, 1, 1)
         
     | 
| 
      
 121 
     | 
    
         
            +
                p babylonian_date                            #=> NebuchadnezzarII01(-603).01.01
         
     | 
| 
      
 122 
     | 
    
         
            +
                p When.when?('NebuchadnezzarII1.1.1')        #=> NebuchadnezzarII01(-603).01.01, the same date
         
     | 
| 
      
 123 
     | 
    
         
            +
                p babylonian_date.to_i                       #=> 1500904, Julian Day Number(Integer)
         
     | 
| 
      
 124 
     | 
    
         
            +
                p When.era('NebuchadnezzarII')               #=> [_e:AncientOrient::Neo-Babylonian::NebuchadnezzarII]
         
     | 
| 
      
 125 
     | 
    
         
            +
                p When.era('NebuchadnezzarII')[0] ^ 1500904  #=> NebuchadnezzarII01(-603).01.01, the same date
         
     | 
| 
      
 126 
     | 
    
         
            +
                p babylonian_date.to_f                       #=> 1500904.0, at noon for UTC
         
     | 
| 
      
 127 
     | 
    
         
            +
                p babylonian_date.frame.iri                  #=> "http://hosi.org/When/CalendarTypes/BabylonianPD"
         
     | 
| 
      
 128 
     | 
    
         
            +
                p babylonian_date.calendar_era.iri           #=> "http://hosi.org/When/TM/CalendarEra/AncientOrient::Neo-Babylonian::NebuchadnezzarII"
         
     | 
| 
      
 129 
     | 
    
         
            +
                
         
     | 
| 
      
 130 
     | 
    
         
            +
                babylonian_date = When.when?('NebuchadnezzarII1.1.1T18:13:00',
         
     | 
| 
      
 131 
     | 
    
         
            +
                                             :clock=>'+03:00?long=45&lat=32&border=Sunset')
         
     | 
| 
      
 132 
     | 
    
         
            +
                4.times do
         
     | 
| 
      
 133 
     | 
    
         
            +
                  p [babylonian_date, babylonian_date.to_i]  #=>
         
     | 
| 
      
 134 
     | 
    
         
            +
                    # [NebuchadnezzarII01(-603).01.01T:18:13:00+03:00, 1500904]
         
     | 
| 
      
 135 
     | 
    
         
            +
                    # [NebuchadnezzarII01(-603).01.01T:18:14:00+03:00, 1500904]
         
     | 
| 
      
 136 
     | 
    
         
            +
                    # [NebuchadnezzarII01(-603).01.02T*18:15:00+03:00, 1500905]
         
     | 
| 
      
 137 
     | 
    
         
            +
                    # [NebuchadnezzarII01(-603).01.02T*18:16:00+03:00, 1500905]
         
     | 
| 
      
 138 
     | 
    
         
            +
                  babylonian_date += When::PT1M
         
     | 
| 
      
 139 
     | 
    
         
            +
                end
         
     | 
| 
      
 140 
     | 
    
         
            +
                
         
     | 
| 
      
 141 
     | 
    
         
            +
                # Web service ----------------------------------
         
     | 
| 
      
 142 
     | 
    
         
            +
                #  retrieve JSON, JSON-LD, Turtle response from http://hosi.org:3000 (when_exe demonstration web server)
         
     | 
| 
      
 143 
     | 
    
         
            +
                # (Notation3, RDF/XML, N-Triples and XML formats are also available.)
         
     | 
| 
      
 144 
     | 
    
         
            +
                require 'open-uri'
         
     | 
| 
      
 145 
     | 
    
         
            +
                open('http://hosi.org:3000/Date/2014-04-20.json') do |json|
         
     | 
| 
      
 146 
     | 
    
         
            +
                  puts json.read #=> newlines and blanks are inserted for readability.
         
     | 
| 
      
 147 
     | 
    
         
            +
                   # {"frame"    : "http://hosi.org/When/CalendarTypes/Gregorian",
         
     | 
| 
      
 148 
     | 
    
         
            +
                   #  "precision": 0,
         
     | 
| 
      
 149 
     | 
    
         
            +
                   #  "location" : "http://hosi.org/When/Coordinates/Spatial?long=139.4441E&lat=35.3916N&alt=0.0",
         
     | 
| 
      
 150 
     | 
    
         
            +
                   #  "sdn"      : 2456768,
         
     | 
| 
      
 151 
     | 
    
         
            +
                   #  "calendar" : ["http://hosi.org/When/CalendarTypes/Gregorian"],
         
     | 
| 
      
 152 
     | 
    
         
            +
                   #  "notes"    : [[{"note":"Month","value":"April"}],
         
     | 
| 
      
 153 
     | 
    
         
            +
                   #                [{"note":"Week","value":"Sunday(6)"}]],
         
     | 
| 
      
 154 
     | 
    
         
            +
                   #  "clock"    : "Asia/Tokyo+09:00",
         
     | 
| 
      
 155 
     | 
    
         
            +
                   #  "clk_time" : [2456768,0,0,0],
         
     | 
| 
      
 156 
     | 
    
         
            +
                   #  "dynamical": 1397919667.184082,
         
     | 
| 
      
 157 
     | 
    
         
            +
                   #  "universal": 1397919600.0,
         
     | 
| 
      
 158 
     | 
    
         
            +
                   #  "cal_date" : [2014,4,20]}
         
     | 
| 
      
 159 
     | 
    
         
            +
                end
         
     | 
| 
      
 160 
     | 
    
         
            +
                
         
     | 
| 
      
 161 
     | 
    
         
            +
                open('http://hosi.org/tp/2014-04-20.json') do |json| # redirected from http://hosi.org to http://hosi.org:3000
         
     | 
| 
      
 162 
     | 
    
         
            +
                  puts json.read #=> newlines and blanks are inserted for readability.
         
     | 
| 
      
 163 
     | 
    
         
            +
                   # {"frame"    : "http://hosi.org/When/CalendarTypes/Gregorian",
         
     | 
| 
      
 164 
     | 
    
         
            +
                   #  "precision": 0,
         
     | 
| 
      
 165 
     | 
    
         
            +
                   #  "sdn"      : 2456768,
         
     | 
| 
      
 166 
     | 
    
         
            +
                   #  "calendar" : ["http://hosi.org/When/CalendarTypes/Gregorian"],
         
     | 
| 
      
 167 
     | 
    
         
            +
                   #  "notes"    : [[{"note":"Month","value":"April"}],
         
     | 
| 
      
 168 
     | 
    
         
            +
                   #               [{"note":"Week","value":"Sunday(6)"}]],
         
     | 
| 
      
 169 
     | 
    
         
            +
                   #  "cal_date" : [2014,4,20]}
         
     | 
| 
      
 170 
     | 
    
         
            +
                end
         
     | 
| 
      
 171 
     | 
    
         
            +
                
         
     | 
| 
      
 172 
     | 
    
         
            +
                open('http://hosi.org/tp/2014-04-20.jsonld') do |jsonld| # redirected from http://hosi.org to http://hosi.org:3000
         
     | 
| 
      
 173 
     | 
    
         
            +
                  puts jsonld.read #=> newlines and blanks are inserted for readability.
         
     | 
| 
      
 174 
     | 
    
         
            +
                   # {"@context":
         
     | 
| 
      
 175 
     | 
    
         
            +
                   #    {"xsd" :"http://www.w3.org/2001/XMLSchema",
         
     | 
| 
      
 176 
     | 
    
         
            +
                   #     "rdf" :"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
         
     | 
| 
      
 177 
     | 
    
         
            +
                   #     "rdfs":"http://www.w3.org/2000/01/rdf-schema#",
         
     | 
| 
      
 178 
     | 
    
         
            +
                   #     "owl" :"http://www.w3.org/2002/07/owl#",
         
     | 
| 
      
 179 
     | 
    
         
            +
                   #     "dc"  :"http://purl.org/dc/elements/1.1/",
         
     | 
| 
      
 180 
     | 
    
         
            +
                   #     "dcq" :"http://purl.org/dc/terms/",
         
     | 
| 
      
 181 
     | 
    
         
            +
                   #     "dct" :"http://purl.org/dc/dcmitype/",
         
     | 
| 
      
 182 
     | 
    
         
            +
                   #     "ts"  :"http://hosi.org/ts#",
         
     | 
| 
      
 183 
     | 
    
         
            +
                   #     "Week":"http://hosi.org/When/Coordinates/Common::Week::",
         
     | 
| 
      
 184 
     | 
    
         
            +
                   #     "day" :"http://hosi.org/When/CalendarNote/Christian/Notes::day::"},
         
     | 
| 
      
 185 
     | 
    
         
            +
                   #  "@graph":[{
         
     | 
| 
      
 186 
     | 
    
         
            +
                   #    "rdf:type"     : {"@id":"http://hosi.org/ts/When/TM/CalDate"},
         
     | 
| 
      
 187 
     | 
    
         
            +
                   #    "@id"          : "http://hosi.org/tp/2014-04-20",
         
     | 
| 
      
 188 
     | 
    
         
            +
                   #    "ts:sdn"       : 2456768,
         
     | 
| 
      
 189 
     | 
    
         
            +
                   #    "ts:frame"     : {"@id":"http://hosi.org/When/CalendarTypes/Gregorian"},
         
     | 
| 
      
 190 
     | 
    
         
            +
                   #    "ts:coordinate": "20",
         
     | 
| 
      
 191 
     | 
    
         
            +
                   #    "@reverse"     : {"rdfs:member":{"@id":"http://hosi.org/tp/2014-04"}},
         
     | 
| 
      
 192 
     | 
    
         
            +
                   #    "day:Week"     : {"@id":"Week:Sunday"},
         
     | 
| 
      
 193 
     | 
    
         
            +
                   #    "day:Easter"   : "easter(0)",
         
     | 
| 
      
 194 
     | 
    
         
            +
                   #    "day:Christmas": "christmas(-249)"
         
     | 
| 
      
 195 
     | 
    
         
            +
                   #   }]
         
     | 
| 
      
 196 
     | 
    
         
            +
                   # }
         
     | 
| 
      
 197 
     | 
    
         
            +
                end
         
     | 
| 
      
 198 
     | 
    
         
            +
                
         
     | 
| 
      
 199 
     | 
    
         
            +
                open('http://hosi.org/tp/2014-04-20.ttl') do |ttl| # redirected from http://hosi.org to http://hosi.org:3000
         
     | 
| 
      
 200 
     | 
    
         
            +
                  puts ttl.read
         
     | 
| 
      
 201 
     | 
    
         
            +
                   # @prefix Week: <http://hosi.org/When/Coordinates/Common::Week::> .
         
     | 
| 
      
 202 
     | 
    
         
            +
                   # @prefix day: <http://hosi.org/When/CalendarNote/Christian/Notes::day::> .
         
     | 
| 
      
 203 
     | 
    
         
            +
                   # @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
         
     | 
| 
      
 204 
     | 
    
         
            +
                   # @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
         
     | 
| 
      
 205 
     | 
    
         
            +
                   # @prefix ts: <http://hosi.org/ts#> .
         
     | 
| 
      
 206 
     | 
    
         
            +
                   # @prefix xsd: <http://www.w3.org/2001/XMLSchema> .
         
     | 
| 
      
 207 
     | 
    
         
            +
                   # 
         
     | 
| 
      
 208 
     | 
    
         
            +
                   # <http://hosi.org/tp/2014-04> rdfs:member <http://hosi.org/tp/2014-04-20> .
         
     | 
| 
      
 209 
     | 
    
         
            +
                   # 
         
     | 
| 
      
 210 
     | 
    
         
            +
                   # <http://hosi.org/tp/2014-04-20> a <http://hosi.org/ts/When/TM/CalDate>;
         
     | 
| 
      
 211 
     | 
    
         
            +
                   #    day:Christmas "christmas(-249)";
         
     | 
| 
      
 212 
     | 
    
         
            +
                   #    day:Easter "easter(0)";
         
     | 
| 
      
 213 
     | 
    
         
            +
                   #    day:Week Week:Sunday;
         
     | 
| 
      
 214 
     | 
    
         
            +
                   #    ts:coordinate "20";
         
     | 
| 
      
 215 
     | 
    
         
            +
                   #    ts:frame <http://hosi.org/When/CalendarTypes/Gregorian>;
         
     | 
| 
      
 216 
     | 
    
         
            +
                   #    ts:sdn 2456768 .
         
     | 
| 
      
 217 
     | 
    
         
            +
                end
         
     | 
| 
      
 218 
     | 
    
         
            +
                
         
     | 
| 
      
 219 
     | 
    
         
            +
                open('http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge.ttl') do |ttl| # redirected from http://hosi.org to http://hosi.org:3000
         
     | 
| 
      
 220 
     | 
    
         
            +
                  puts ttl.read
         
     | 
| 
      
 221 
     | 
    
         
            +
                   # @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
         
     | 
| 
      
 222 
     | 
    
         
            +
                   # @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
         
     | 
| 
      
 223 
     | 
    
         
            +
                   # @prefix ts: <http://hosi.org/ts#> .
         
     | 
| 
      
 224 
     | 
    
         
            +
                   # @prefix xsd: <http://www.w3.org/2001/XMLSchema> .
         
     | 
| 
      
 225 
     | 
    
         
            +
                   # 
         
     | 
| 
      
 226 
     | 
    
         
            +
                   # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge> a <http://hosi.org/ts/When/TM/OrdinalReferenceSystem>;
         
     | 
| 
      
 227 
     | 
    
         
            +
                   #    rdfs:member <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::冥王代>,
         
     | 
| 
      
 228 
     | 
    
         
            +
                   #      <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::始生代>,
         
     | 
| 
      
 229 
     | 
    
         
            +
                   #      <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::原生代>,
         
     | 
| 
      
 230 
     | 
    
         
            +
                   #      <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::顕生代> .
         
     | 
| 
      
 231 
     | 
    
         
            +
                   # 
         
     | 
| 
      
 232 
     | 
    
         
            +
                   # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::冥王代> a <http://hosi.org/ts/When/TM/OrdinalEra>;
         
     | 
| 
      
 233 
     | 
    
         
            +
                   #    ts:begin "-4600000000";
         
     | 
| 
      
 234 
     | 
    
         
            +
                   #    ts:end "-4000000000";
         
     | 
| 
      
 235 
     | 
    
         
            +
                   #    ts:label <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::冥王代::冥王代> .
         
     | 
| 
      
 236 
     | 
    
         
            +
                   # 
         
     | 
| 
      
 237 
     | 
    
         
            +
                   # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::原生代> a <http://hosi.org/ts/When/TM/OrdinalEra>;
         
     | 
| 
      
 238 
     | 
    
         
            +
                   #    ts:begin "-2500000000";
         
     | 
| 
      
 239 
     | 
    
         
            +
                   #    ts:end "-542000000";
         
     | 
| 
      
 240 
     | 
    
         
            +
                   #    ts:label <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::原生代::原生代>;
         
     | 
| 
      
 241 
     | 
    
         
            +
                   #    rdfs:member <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::原生代::前期>,
         
     | 
| 
      
 242 
     | 
    
         
            +
                   #      <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::原生代::中期>,
         
     | 
| 
      
 243 
     | 
    
         
            +
                   #      <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::原生代::後期> .
         
     | 
| 
      
 244 
     | 
    
         
            +
                   # <..snip..>
         
     | 
| 
      
 245 
     | 
    
         
            +
                end
         
     | 
| 
      
 246 
     | 
    
         
            +
                
         
     | 
| 
      
 247 
     | 
    
         
            +
                #
         
     | 
| 
      
 248 
     | 
    
         
            +
                # SPARQL endpoint ------------------------------
         
     | 
| 
      
 249 
     | 
    
         
            +
                #  https://rubygems.org/gems/sparql is required for this section's operations.
         
     | 
| 
      
 250 
     | 
    
         
            +
                #  Please install sparql before operation.
         
     | 
| 
      
 251 
     | 
    
         
            +
                
         
     | 
| 
      
 252 
     | 
    
         
            +
                require 'sparql'
         
     | 
| 
      
 253 
     | 
    
         
            +
                PREFIXES = When::Parts::Resource.namespace_prefixes(
         
     | 
| 
      
 254 
     | 
    
         
            +
                  '_co:Common', '_co:Common?V=0618', '_m:Calendar', '_m:Japanese', '_n:Japanese/Notes')
         
     | 
| 
      
 255 
     | 
    
         
            +
                
         
     | 
| 
      
 256 
     | 
    
         
            +
                client = SPARQL::Client.new("http://hosi.org/japan/sparql")
         
     | 
| 
      
 257 
     | 
    
         
            +
                
         
     | 
| 
      
 258 
     | 
    
         
            +
                client.query(PREFIXES.keys.map {|key|
         
     | 
| 
      
 259 
     | 
    
         
            +
                  "PREFIX #{key}: <#{PREFIXES[key].last}> "}.join("\n") +
         
     | 
| 
      
 260 
     | 
    
         
            +
                  %(
         
     | 
| 
      
 261 
     | 
    
         
            +
                    SELECT DISTINCT ?s
         
     | 
| 
      
 262 
     | 
    
         
            +
                    WHERE {
         
     | 
| 
      
 263 
     | 
    
         
            +
                      ?s ts:coordinate "10" .
         
     | 
| 
      
 264 
     | 
    
         
            +
                      ?s DayNote:廿四節気 SolarTerm:清明 .
         
     | 
| 
      
 265 
     | 
    
         
            +
                      ?s DayNote:干支     Stem-Branch:壬戌 .
         
     | 
| 
      
 266 
     | 
    
         
            +
                    }
         
     | 
| 
      
 267 
     | 
    
         
            +
                  )).each do |solution|
         
     | 
| 
      
 268 
     | 
    
         
            +
                  p solution[:s].to_s #=>
         
     | 
| 
      
 269 
     | 
    
         
            +
                    #=> "http://hosi.org/tp/0689-03-10%5E%5EJapanese"
         
     | 
| 
      
 270 
     | 
    
         
            +
                    #=> "http://hosi.org/tp/1490-03-10%5E%5EJapanese"
         
     | 
| 
      
 271 
     | 
    
         
            +
                end
         
     | 
| 
      
 272 
     | 
    
         
            +
                
         
     | 
| 
      
 273 
     | 
    
         
            +
                #
         
     | 
| 
      
 274 
     | 
    
         
            +
                # TZInfo ---------------------------------------
         
     | 
| 
      
 275 
     | 
    
         
            +
                #  https://rubygems.org/gems/tzinfo is required for this section's operations.
         
     | 
| 
      
 276 
     | 
    
         
            +
                #  Please install tzinfo before operation.
         
     | 
| 
      
 277 
     | 
    
         
            +
                
         
     | 
| 
      
 278 
     | 
    
         
            +
                gregorian_date = When.tm_pos(2014, 8, 1, 9, 0, 0, :tz=>'Asia/Tokyo')
         
     | 
| 
      
 279 
     | 
    
         
            +
                p gregorian_date                             #=> 2014-08-01T09:00:00+09:00
         
     | 
| 
      
 280 
     | 
    
         
            +
                p gregorian_date.location.iri                #=> "http://hosi.org/When/Coordinates/Spatial?long=139.4441E&lat=35.3916N&label=Asia/Tokyo"
         
     | 
| 
      
 281 
     | 
    
         
            +
                p gregorian_date.sunrise.floor(When::MINUTE) #=> 2014-08-01T04:48+09:00
         
     | 
| 
      
 282 
     | 
    
         
            +
                p gregorian_date.sunset.floor(When::MINUTE)  #=> 2014-08-01T18:45+09:00
         
     | 
| 
      
 283 
     | 
    
         
            +
                
         
     | 
| 
      
 284 
     | 
    
         
            +
                jst = When.tm_pos(1997, 4, 6, 15, 30, 00, :tz=>'Asia/Tokyo')
         
     | 
| 
      
 285 
     | 
    
         
            +
                p jst                                        #=> 1997-04-06T15:30:00+09:00
         
     | 
| 
      
 286 
     | 
    
         
            +
                est = When.Clock('America/New_York') ^ jst
         
     | 
| 
      
 287 
     | 
    
         
            +
                p est                                        #=> 1997-04-06T01:30:00-05:00
         
     | 
| 
      
 288 
     | 
    
         
            +
                jst = When.tm_pos(1997, 4, 6, 16, 30, 00, :tz=>'Asia/Tokyo')
         
     | 
| 
      
 289 
     | 
    
         
            +
                p jst                                        #=> 1997-04-06T16:30:00+09:00
         
     | 
| 
      
 290 
     | 
    
         
            +
                edt = When.Clock('America/New_York') ^ jst
         
     | 
| 
      
 291 
     | 
    
         
            +
                p edt                                        #=> 1997-04-06T03:30:00-04:00
         
     | 
| 
      
 292 
     | 
    
         
            +
                
         
     | 
| 
      
 293 
     | 
    
         
            +
                p When.when?('TZID=America/New_York:1997-10-26T01:30') #=> 1997-10-26T01:30-04:00
         
     | 
| 
      
 294 
     | 
    
         
            +
                p When.when?('TZID=America/New_York:1997-10-26T01=30') #=> 1997-10-26T01:30-05:00, '=' indicates "leap hour"
         
     | 
| 
      
 295 
     | 
    
         
            +
                p When.when?('TZID=America/New_York:1997-10-26T02:30') #=> 1997-10-26T02:30-05:00
         
     | 
| 
      
 296 
     | 
    
         
            +
                p When.when?('TZID=America/New_York:1997-10-26T03:30') #=> 1997-10-26T03:30-05:00
         
     | 
| 
      
 297 
     | 
    
         
            +
                
         
     | 
| 
      
 298 
     | 
    
         
            +
                # Google Calendar ------------------------------
         
     | 
| 
      
 299 
     | 
    
         
            +
                #  https://github.com/suchowan/gcalapi is required for this section's operations.
         
     | 
| 
      
 300 
     | 
    
         
            +
                #  Please install gcalapi before operation.
         
     | 
| 
      
 301 
     | 
    
         
            +
                #  Please replace xxxxxxxx and ******** to valid id/password pair and access Google Calendar.
         
     | 
| 
      
 302 
     | 
    
         
            +
                
         
     | 
| 
      
 303 
     | 
    
         
            +
                service = GoogleCalendar::Service.new('xxxxxxxx@gmail.com', '********')
         
     | 
| 
      
 304 
     | 
    
         
            +
                feed = "http://www.google.com/calendar/feeds/%s__%s%%40holiday.calendar.google.com/public/full" %
         
     | 
| 
      
 305 
     | 
    
         
            +
                        ['japanese', 'ja']
         
     | 
| 
      
 306 
     | 
    
         
            +
                gcal = GoogleCalendar::Calendar::new(service, feed)
         
     | 
| 
      
 307 
     | 
    
         
            +
                gcal.enum_for({'start-min'=>'2014-01-01', 'start-max'=>'2015-01-01',
         
     | 
| 
      
 308 
     | 
    
         
            +
                               'orderby'=>'starttime', 'sortorder'=>'a'
         
     | 
| 
      
 309 
     | 
    
         
            +
                              }).each do |range|
         
     | 
| 
      
 310 
     | 
    
         
            +
                  puts '%s - %s' % [range, range.events[0].summary] #=>
         
     | 
| 
      
 311 
     | 
    
         
            +
                    # 2014-01-01T00:00:00.00+09:00...2014-01-02T00:00:00.00+09:00 - 元日
         
     | 
| 
      
 312 
     | 
    
         
            +
                    # 2014-01-02T00:00:00.00+09:00...2014-01-03T00:00:00.00+09:00 - 銀行休業日
         
     | 
| 
      
 313 
     | 
    
         
            +
                    # 2014-01-03T00:00:00.00+09:00...2014-01-04T00:00:00.00+09:00 - 銀行休業日
         
     | 
| 
      
 314 
     | 
    
         
            +
                    # 2014-01-13T00:00:00.00+09:00...2014-01-14T00:00:00.00+09:00 - 成人の日
         
     | 
| 
      
 315 
     | 
    
         
            +
                    # 2014-02-11T00:00:00.00+09:00...2014-02-12T00:00:00.00+09:00 - 建国記念の日
         
     | 
| 
      
 316 
     | 
    
         
            +
                    # 2014-03-21T00:00:00.00+09:00...2014-03-22T00:00:00.00+09:00 - 春分の日
         
     | 
| 
      
 317 
     | 
    
         
            +
                    # 2014-04-29T00:00:00.00+09:00...2014-04-30T00:00:00.00+09:00 - 昭和の日
         
     | 
| 
      
 318 
     | 
    
         
            +
                    # 2014-05-03T00:00:00.00+09:00...2014-05-04T00:00:00.00+09:00 - 憲法記念日
         
     | 
| 
      
 319 
     | 
    
         
            +
                    # 2014-05-04T00:00:00.00+09:00...2014-05-05T00:00:00.00+09:00 - みどりの日
         
     | 
| 
      
 320 
     | 
    
         
            +
                    # 2014-05-05T00:00:00.00+09:00...2014-05-06T00:00:00.00+09:00 - こどもの日
         
     | 
| 
      
 321 
     | 
    
         
            +
                    # 2014-05-06T00:00:00.00+09:00...2014-05-07T00:00:00.00+09:00 - みどりの日 振替休日
         
     | 
| 
      
 322 
     | 
    
         
            +
                    # 2014-07-21T00:00:00.00+09:00...2014-07-22T00:00:00.00+09:00 - 海の日
         
     | 
| 
      
 323 
     | 
    
         
            +
                    # 2014-09-15T00:00:00.00+09:00...2014-09-16T00:00:00.00+09:00 - 敬老の日
         
     | 
| 
      
 324 
     | 
    
         
            +
                    # 2014-09-23T00:00:00.00+09:00...2014-09-24T00:00:00.00+09:00 - 秋分の日
         
     | 
| 
      
 325 
     | 
    
         
            +
                    # 2014-10-13T00:00:00.00+09:00...2014-10-14T00:00:00.00+09:00 - 体育の日
         
     | 
| 
      
 326 
     | 
    
         
            +
                    # 2014-11-03T00:00:00.00+09:00...2014-11-04T00:00:00.00+09:00 - 文化の日
         
     | 
| 
      
 327 
     | 
    
         
            +
                    # 2014-11-23T00:00:00.00+09:00...2014-11-24T00:00:00.00+09:00 - 勤労感謝の日
         
     | 
| 
      
 328 
     | 
    
         
            +
                    # 2014-11-24T00:00:00.00+09:00...2014-11-25T00:00:00.00+09:00 - 勤労感謝の日 振替休日
         
     | 
| 
      
 329 
     | 
    
         
            +
                    # 2014-12-23T00:00:00.00+09:00...2014-12-24T00:00:00.00+09:00 - 天皇誕生日
         
     | 
| 
      
 330 
     | 
    
         
            +
                    # 2014-12-25T00:00:00.00+09:00...2014-12-26T00:00:00.00+09:00 - クリスマス
         
     | 
| 
      
 331 
     | 
    
         
            +
                    # 2014-12-31T00:00:00.00+09:00...2015-01-01T00:00:00.00+09:00 - 大晦日
         
     | 
| 
      
 332 
     | 
    
         
            +
                end
         
     | 
| 
      
 333 
     | 
    
         
            +
             
     |