rtm-ontopia 0.3.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/DISCLAIMER +15 -0
  2. data/LICENSE +201 -0
  3. data/README +8 -0
  4. data/lib/rtm-ontopia.rb +4 -0
  5. data/lib/rtm/ontopia.rb +271 -0
  6. data/lib/rtm/ontopia/io/to_cxtm.rb +40 -0
  7. data/lib/rtm/ontopia/javalibs/antlr-2.7.7.jar +0 -0
  8. data/lib/rtm/ontopia/javalibs/avalon-framework-4.1.3.jar +0 -0
  9. data/lib/rtm/ontopia/javalibs/backport-util-concurrent-3.1.jar +0 -0
  10. data/lib/rtm/ontopia/javalibs/commons-dbcp-1.3.jar +0 -0
  11. data/lib/rtm/ontopia/javalibs/commons-fileupload-1.1.jar +0 -0
  12. data/lib/rtm/ontopia/javalibs/commons-io-1.1.jar +0 -0
  13. data/lib/rtm/ontopia/javalibs/commons-pool-1.5.4.jar +0 -0
  14. data/lib/rtm/ontopia/javalibs/concurrent-1.3.4.jar +0 -0
  15. data/lib/rtm/ontopia/javalibs/dom4j-1.6.1.jar +0 -0
  16. data/lib/rtm/ontopia/javalibs/fontbox-1.1.0.jar +0 -0
  17. data/lib/rtm/ontopia/javalibs/geronimo-stax-api_1.0_spec-1.0.jar +0 -0
  18. data/lib/rtm/ontopia/javalibs/icu4j-3.4.4.jar +0 -0
  19. data/lib/rtm/ontopia/javalibs/iri-0.8.jar +0 -0
  20. data/lib/rtm/ontopia/javalibs/java-getopt-1.0.9.jar +0 -0
  21. data/lib/rtm/ontopia/javalibs/jempbox-1.1.0.jar +0 -0
  22. data/lib/rtm/ontopia/javalibs/jena-2.6.2.jar +0 -0
  23. data/lib/rtm/ontopia/javalibs/jflex-1.4.3.jar +0 -0
  24. data/lib/rtm/ontopia/javalibs/jgroups-2.6.10.GA.jar +0 -0
  25. data/lib/rtm/ontopia/javalibs/joda-time-1.6.jar +0 -0
  26. data/lib/rtm/ontopia/javalibs/jsp-api-2.0.jar +0 -0
  27. data/lib/rtm/ontopia/javalibs/jstl-1.1.2.jar +0 -0
  28. data/lib/rtm/ontopia/javalibs/jtidy-r8-20060801.jar +0 -0
  29. data/lib/rtm/ontopia/javalibs/logkit-1.0.1.jar +0 -0
  30. data/lib/rtm/ontopia/javalibs/ontopia-engine-5.1.0.jar +0 -0
  31. data/lib/rtm/ontopia/javalibs/ontopia-mio-0.1.0-SNAPSHOT.jar +0 -0
  32. data/lib/rtm/ontopia/javalibs/opencsv-1.8.jar +0 -0
  33. data/lib/rtm/ontopia/javalibs/pdfbox-1.1.0.jar +0 -0
  34. data/lib/rtm/ontopia/javalibs/poi-3.6.jar +0 -0
  35. data/lib/rtm/ontopia/javalibs/poi-ooxml-3.6.jar +0 -0
  36. data/lib/rtm/ontopia/javalibs/poi-ooxml-schemas-3.6.jar +0 -0
  37. data/lib/rtm/ontopia/javalibs/poi-scratchpad-3.6.jar +0 -0
  38. data/lib/rtm/ontopia/javalibs/saxon-6.5.3.jar +0 -0
  39. data/lib/rtm/ontopia/javalibs/servlet-api-2.4.jar +0 -0
  40. data/lib/rtm/ontopia/javalibs/standard-1.1.2.jar +0 -0
  41. data/lib/rtm/ontopia/javalibs/stax-api-1.0.1.jar +0 -0
  42. data/lib/rtm/ontopia/javalibs/tagsoup-1.2.jar +0 -0
  43. data/lib/rtm/ontopia/javalibs/velocity-1.3.jar +0 -0
  44. data/lib/rtm/ontopia/javalibs/wicket-1.4.8.jar +0 -0
  45. data/lib/rtm/ontopia/javalibs/wicket-datetime-1.4.8.jar +0 -0
  46. data/lib/rtm/ontopia/javalibs/wicket-extensions-1.4.8.jar +0 -0
  47. data/lib/rtm/ontopia/javalibs/xercesImpl-2.7.1.jar +0 -0
  48. data/lib/rtm/ontopia/javalibs/xml-apis-1.0.b2.jar +0 -0
  49. data/lib/rtm/ontopia/javalibs/xmlbeans-2.3.0.jar +0 -0
  50. data/lib/rtm/ontopia/ontopia_example.props +14 -0
  51. data/lib/rtm/ontopia/rdbms/properties.rb +149 -0
  52. data/lib/rtm/ontopia/rdbms/store.rb +39 -0
  53. data/res/rdbms/config/db.h2.props +8 -0
  54. data/res/rdbms/config/db.mysql.props +8 -0
  55. data/res/rdbms/config/db.oracle8.props +8 -0
  56. data/res/rdbms/config/db.oracle9i.props +8 -0
  57. data/res/rdbms/config/db.postgresql.props +8 -0
  58. data/res/rdbms/config/db.sqlserver.props +8 -0
  59. data/res/rdbms/setup/generic.create.sql +154 -0
  60. data/res/rdbms/setup/generic.drop.sql +16 -0
  61. data/res/rdbms/setup/h2.create.sql +154 -0
  62. data/res/rdbms/setup/h2.drop.sql +16 -0
  63. data/res/rdbms/setup/mysql.create.sql +170 -0
  64. data/res/rdbms/setup/mysql.drop.sql +16 -0
  65. data/res/rdbms/setup/mysql.force_drop.sql +16 -0
  66. data/res/rdbms/setup/oracle10g.create.sql +202 -0
  67. data/res/rdbms/setup/oracle10g.drop.sql +59 -0
  68. data/res/rdbms/setup/oracle8.create.sql +202 -0
  69. data/res/rdbms/setup/oracle8.drop.sql +59 -0
  70. data/res/rdbms/setup/oracle9i.create.sql +202 -0
  71. data/res/rdbms/setup/oracle9i.drop.sql +59 -0
  72. data/res/rdbms/setup/postgresql.create.sql +191 -0
  73. data/res/rdbms/setup/postgresql.drop.sql +53 -0
  74. data/res/rdbms/setup/sqlserver.create.sql +154 -0
  75. data/res/rdbms/setup/sqlserver.drop.sql +16 -0
  76. metadata +152 -0
@@ -0,0 +1,40 @@
1
+ # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
+ # License: Apache License, Version 2.0
3
+
4
+
5
+ module RTM::IO
6
+ # Import and Export of TMAPI Topic Maps
7
+ # Utilizing the Ontopia libary http://code.google.com/p/tmapix/
8
+ # Consequently the (de-) serializer provided here
9
+ # are only Wrapper
10
+
11
+ module Ontopia
12
+ module TopicMap
13
+ def to_cxtm(file=nil)
14
+ raise("Only supported for Ontopia.") unless self.kind_of?(Java::NetOntopiaTopicmapsImplTmapi2::TopicMapImpl)
15
+ if file
16
+ if file.is_a?(java.io.OutputStream)
17
+ out_stream = file
18
+ else
19
+ out_stream = java.io.BufferedOutputStream.new(java.io.FileOutputStream.new(file))
20
+ end
21
+ else
22
+ # if no file was given we want to return a string which will be written into a stream by the writer
23
+ out_stream = java.io.ByteArrayOutputStream.new
24
+ end
25
+
26
+ writer = Java::NetOntopiaTopicmapsXml::CanonicalXTMWriter.new(out_stream)
27
+ writer.write(self.wrapped)
28
+ out_stream.flush
29
+
30
+ # close the file unless we were provided with a stream
31
+ out_stream.close unless file && file.is_a?(java.io.OutputStream)
32
+
33
+ # if there was no file, we have a ByteArrayOutputStream. Get the String out of it (and return it)
34
+ out_stream.to_s unless file
35
+ end
36
+ end
37
+
38
+ RTM.register_extension(self)
39
+ end
40
+ end
@@ -0,0 +1,14 @@
1
+ net.ontopia.topicmaps.store=rdbms
2
+ net.ontopia.topicmaps.impl.rdbms.Database=mysql
3
+ net.ontopia.topicmaps.impl.rdbms.ConnectionString=jdbc:mysql://localhost/database_name?useUnicode=yes&characterEncoding=utf8&relaxAutoCommit=true
4
+ #net.ontopia.topicmaps.impl.rdbms.ConnectionString=jdbc:log4jdbc:mysql://localhost/database_name?useUnicode=yes&characterEncoding=utf8&relaxAutoCommit=true
5
+ net.ontopia.topicmaps.impl.rdbms.DriverClass=com.mysql.jdbc.Driver
6
+ #net.ontopia.topicmaps.impl.rdbms.DriverClass=net.sf.log4jdbc.DriverSpy
7
+
8
+ net.ontopia.topicmaps.impl.rdbms.UserName=username
9
+ net.ontopia.topicmaps.impl.rdbms.Password=password
10
+
11
+ # tuning
12
+ net.ontopia.topicmaps.impl.rdbms.ConnectionPool=true
13
+ net.ontopia.topicmaps.impl.rdbms.BatchUpdates=true
14
+ net.ontopia.topicmaps.impl.rdbms.StorePool.MinimumSize=2
@@ -0,0 +1,149 @@
1
+ module RTM::Ontopia::Rdbms
2
+
3
+ module Properties
4
+ def self.rails2ontopia(config)
5
+ ontopia_properties = {}
6
+ ontopia_prefix = "net.ontopia.topicmaps."
7
+ ontopia_properties["#{ontopia_prefix}store"] = config[:store] || "rdbms"
8
+ ontopia_rdbms_prefix = "#{ontopia_prefix}impl.rdbms."
9
+
10
+ adapter = config[:adapter].sub(/^jdbc/, '')
11
+
12
+ adapter_config = "#{adapter}_config".to_s
13
+ config = DatabaseDefaults.send(adapter_config, config) if DatabaseDefaults.respond_to?(adapter_config)
14
+
15
+ ontopia_properties["#{ontopia_rdbms_prefix}Database"] = adapter
16
+ ontopia_properties["#{ontopia_rdbms_prefix}DriverClass"] = config[:driver]
17
+ ontopia_properties["#{ontopia_rdbms_prefix}ConnectionString"] = config[:url]
18
+ ontopia_properties["#{ontopia_rdbms_prefix}UserName"] = config[:username] || "sa"
19
+ ontopia_properties["#{ontopia_rdbms_prefix}Password"] = config[:password] || ""
20
+ ontopia_properties["#{ontopia_rdbms_prefix}ConnectionPool"] = config[:connection_pool] == nil ? false : config[:connection_pool]
21
+ ontopia_properties["#{ontopia_rdbms_prefix}BatchUpdates"] = config[:batch_updates] == nil ? true : config[:batch_updates]
22
+ ontopia_properties["#{ontopia_rdbms_prefix}StorePool.MinimumSize"] = 2
23
+
24
+ ontopia_properties
25
+ end
26
+
27
+ # The defaults for database connections here were extracted from the *_connection methods from
28
+ # activerecord-jdbc-adapter-0.9.2.
29
+ # They had to be copied here because we don't want to establish connections here.
30
+ # The definitions where slightly extended, e.g. the host is optional and defaults to localhost.
31
+ module DatabaseDefaults
32
+ # enhances a config hash using the defaults for cachedb
33
+ def cachedb_config(config)
34
+ config[:host] ||= "localhost"
35
+ config[:port] ||= 1972
36
+ config[:url] ||= "jdbc:Cache://#{config[:host]}:#{config[:port]}/#{config[:database]}"
37
+ config[:driver] ||= "com.intersys.jdbc.CacheDriver"
38
+ config
39
+ end
40
+
41
+ # enhances a config hash using the defaults for db2
42
+ def db2_config(config)
43
+ config[:adapter] ||= "jdbc"
44
+ config[:driver] ||= "com.ibm.db2.jcc.DB2Driver"
45
+ config[:url] ||= "jdbc:db2:#{config[:database]}"
46
+ config
47
+ end
48
+
49
+ # enhances a config hash using the defaults for derby
50
+ def derby_config(config)
51
+ config[:url] ||= "jdbc:derby:#{config[:database]};create=true"
52
+ config[:driver] ||= "org.apache.derby.jdbc.EmbeddedDriver"
53
+ config
54
+ end
55
+
56
+ # enhances a config hash using the defaults for hsqldb
57
+ def hsqldb_config(config)
58
+ # config[:url] ||= "jdbc:hsqldb:#{config[:database]}" # ActiveRecord JDBC default
59
+ config[:url] ||= "jdbc:hsqldb:#{config[:database]};MVCC=true" # Ontopia default
60
+ config[:driver] ||= "org.hsqldb.jdbcDriver"
61
+ config
62
+ end
63
+
64
+ # enhances a config hash using the defaults for h2
65
+ def h2_config(config)
66
+ config[:url] ||= "jdbc:h2:#{config[:database]};MVCC=true"
67
+ config[:url] << config[:h2_params] if config[:h2_params]
68
+ config[:driver] ||= "org.h2.Driver"
69
+ config
70
+ end
71
+
72
+ # enhances a config hash using the defaults for informix
73
+ def informix_config(config)
74
+ config[:host] ||= "localhost"
75
+ config[:servername] ||= config[:host]
76
+ config[:port] ||= 9088
77
+ config[:url] ||= "jdbc:informix-sqli://#{config[:host]}:#{config[:port]}/#{config[:database]}:INFORMIXSERVER=#{config[:servername]}"
78
+ config[:driver] = 'com.informix.jdbc.IfxDriver'
79
+ config
80
+ end
81
+
82
+ # enhances a config hash using the defaults for mysql
83
+ def mssql_config(config)
84
+ config[:host] ||= "localhost"
85
+ config[:adapter] ||= "jdbc" # Ontopia example: sqlserver
86
+ config[:url] ||= "jdbc:jtds:sqlserver://localhost:1433/weblog_development" # Ontopia example: jdbcspy:jdbc:sqlserver://127.0.0.1\\ONTOPIA;databaseName=topicmaps;lockTimeout=60000
87
+ config[:driver] ||= 'net.sourceforge.jtds.jdbc.Driver' # Ontopia example: com.microsoft.sqlserver.jdbc.SQLServerDriver
88
+ config
89
+ end
90
+ alias :sqlserver_config :mssql_config
91
+
92
+ # enhances a config hash using the defaults for mysql
93
+ def mysql_config(config)
94
+ config[:host] ||= "localhost"
95
+ config[:port] ||= 3306
96
+ config[:encoding] ||= 'utf8'
97
+ url_options = "zeroDateTimeBehavior=convertToNull&jdbcCompliantTruncation=false&useUnicode=true&characterEncoding=#{config[:encoding]}"
98
+ if config[:url]
99
+ config[:url] = config[:url]['?'] ? "#{config[:url]}&#{url_options}" : "#{config[:url]}?#{url_options}"
100
+ else
101
+ config[:url] = "jdbc:mysql://#{config[:host]}:#{config[:port]}/#{config[:database]}?#{url_options}"
102
+ end
103
+ config[:driver] = "com.mysql.jdbc.Driver"
104
+ config
105
+ end
106
+
107
+ # enhances a config hash using the defaults for oracle
108
+ def oracle_config(config)
109
+ config[:host] ||= "localhost"
110
+ config[:port] ||= 1521
111
+ config[:url] ||= "jdbc:oracle:thin:@#{config[:host]}:#{config[:port]}:#{config[:database]}"
112
+ config[:driver] ||= "oracle.jdbc.driver.OracleDriver"
113
+ config
114
+ end
115
+ alias :oracle8_config :oracle_config
116
+ alias :oracle9i_config :oracle_config
117
+ alias :oracle10g_config :oracle_config
118
+
119
+ # enhances a config hash using the defaults for postgresql
120
+ def postgresql_config(config)
121
+ config[:host] ||= "localhost"
122
+ config[:port] ||= 5432
123
+ config[:url] ||= "jdbc:postgresql://#{config[:host]}:#{config[:port]}/#{config[:database]}"
124
+ config[:url] << config[:pg_params] if config[:pg_params]
125
+ config[:driver] ||= "org.postgresql.Driver"
126
+ config
127
+ end
128
+
129
+ # enhances a config hash using the defaults for sqlite3
130
+ def sqlite3_config(config)
131
+ config[:database] ||= config[:dbfile]
132
+
133
+ # Allow database path relative to RAILS_ROOT, but only if
134
+ # the database path is not the special path that tells
135
+ # Sqlite to build a database only in memory.
136
+ if Object.const_defined?(:RAILS_ROOT) && ':memory:' != config[:database]
137
+ config[:database] = File.expand_path(config[:database], RAILS_ROOT)
138
+ end
139
+
140
+ config[:url] ||= "jdbc:sqlite:#{config[:database]}"
141
+ config[:driver] ||= "org.sqlite.JDBC"
142
+ config
143
+ end
144
+
145
+ # Make all instance methods also available as module methods
146
+ extend self
147
+ end
148
+ end
149
+ end
@@ -0,0 +1,39 @@
1
+
2
+ class Java::NetOntopiaTopicmapsImplTmapi2::TopicMapImpl
3
+ # Commits the transaction. The changes made are written to the persistent
4
+ # store.
5
+ #
6
+ # The transaction will resume after the commit meaning that the objects
7
+ # retrieved through is still usable after the commit.
8
+ #
9
+ # This is just a convencience method for getWrapped().getStore().commit().
10
+ #
11
+ # @return true
12
+ def commit
13
+ wrapped.store.commit
14
+ true
15
+ end
16
+
17
+ # Aborts the transaction; all changes made inside the transaction are rolled
18
+ # back.
19
+ #
20
+ # The transaction will resume after the abort meaning that the objects
21
+ # retrieved through is still usable after the abort, but their state has
22
+ # been reverted to the state in the persistent store.
23
+ #
24
+ # This is just a convencience method for getWrapped().getStore().abort().
25
+ #
26
+ # @return true
27
+ def abort
28
+ wrapped.store.abort
29
+ true
30
+ end
31
+
32
+ # @private
33
+ # This method is undocumented intentionally because it is here only for
34
+ # those of us who look for "rollback" instead of "abort".
35
+ def rollback
36
+ warn("TopicMap#rollback is only a convenience method for Ontopia's default 'abort'. Please use that instead.")
37
+ abort
38
+ end
39
+ end
@@ -0,0 +1,8 @@
1
+ net.ontopia.topicmaps.impl.rdbms.Database=h2
2
+ net.ontopia.topicmaps.impl.rdbms.ConnectionString=jdbc:h2:/tmp/test2;MVCC=true
3
+ net.ontopia.topicmaps.impl.rdbms.DriverClass=org.h2.Driver
4
+
5
+ net.ontopia.topicmaps.impl.rdbms.UserName=sa
6
+ net.ontopia.topicmaps.impl.rdbms.Password=
7
+
8
+ net.ontopia.topicmaps.impl.rdbms.ConnectionPool=true
@@ -0,0 +1,8 @@
1
+ net.ontopia.topicmaps.impl.rdbms.Database=mysql
2
+ net.ontopia.topicmaps.impl.rdbms.ConnectionString=jdbc:mysql://localhost/topicmaps?useUnicode=yes&characterEncoding=utf8&relaxAutoCommit=true
3
+ net.ontopia.topicmaps.impl.rdbms.DriverClass=com.mysql.jdbc.Driver
4
+
5
+ net.ontopia.topicmaps.impl.rdbms.UserName=foo
6
+ net.ontopia.topicmaps.impl.rdbms.Password=bar
7
+
8
+ net.ontopia.topicmaps.impl.rdbms.ConnectionPool=true
@@ -0,0 +1,8 @@
1
+ net.ontopia.topicmaps.impl.rdbms.Database=oracle8
2
+ net.ontopia.topicmaps.impl.rdbms.ConnectionString=jdbc:oracle:thin:@127.0.0.1:1521:TOPICMAPS
3
+ net.ontopia.topicmaps.impl.rdbms.DriverClass=oracle.jdbc.driver.OracleDriver
4
+
5
+ net.ontopia.topicmaps.impl.rdbms.UserName=foo
6
+ net.ontopia.topicmaps.impl.rdbms.Password=bar
7
+
8
+ net.ontopia.topicmaps.impl.rdbms.ConnectionPool=true
@@ -0,0 +1,8 @@
1
+ net.ontopia.topicmaps.impl.rdbms.Database=oracle9i
2
+ net.ontopia.topicmaps.impl.rdbms.ConnectionString=jdbc:oracle:thin:@127.0.0.1:1521:TOPICMAPS
3
+ net.ontopia.topicmaps.impl.rdbms.DriverClass=oracle.jdbc.driver.OracleDriver
4
+
5
+ net.ontopia.topicmaps.impl.rdbms.UserName=foo
6
+ net.ontopia.topicmaps.impl.rdbms.Password=bar
7
+
8
+ net.ontopia.topicmaps.impl.rdbms.ConnectionPool=true
@@ -0,0 +1,8 @@
1
+ net.ontopia.topicmaps.impl.rdbms.Database=postgresql
2
+ net.ontopia.topicmaps.impl.rdbms.ConnectionString=jdbc:postgresql:topicmaps
3
+ net.ontopia.topicmaps.impl.rdbms.DriverClass=org.postgresql.Driver
4
+
5
+ net.ontopia.topicmaps.impl.rdbms.UserName=foo
6
+ net.ontopia.topicmaps.impl.rdbms.Password=bar
7
+
8
+ net.ontopia.topicmaps.impl.rdbms.ConnectionPool=true
@@ -0,0 +1,8 @@
1
+ net.ontopia.topicmaps.impl.rdbms.Database=sqlserver
2
+ net.ontopia.topicmaps.impl.rdbms.ConnectionString=jdbcspy:jdbc:sqlserver://127.0.0.1\\ONTOPIA;databaseName=topicmaps;lockTimeout=60000
3
+ net.ontopia.topicmaps.impl.rdbms.DriverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver
4
+
5
+ net.ontopia.topicmaps.impl.rdbms.UserName=foo
6
+ net.ontopia.topicmaps.impl.rdbms.Password=bar
7
+
8
+ net.ontopia.topicmaps.impl.rdbms.ConnectionPool=true
@@ -0,0 +1,154 @@
1
+ create table TM_SUBJECT_LOCATORS (
2
+ topic_id integer not null,
3
+ address varchar(512) not null
4
+ );
5
+
6
+ create table TM_VARIANT_NAME_SCOPE (
7
+ scoped_id integer not null,
8
+ theme_id integer not null,
9
+ constraint TM_VARIANT_NAME_SCOPE_pkey primary key (scoped_id, theme_id)
10
+ );
11
+
12
+ create table TM_SUBJECT_IDENTIFIERS (
13
+ topic_id integer not null,
14
+ address varchar(512) not null
15
+ );
16
+
17
+ create table TM_TOPIC_MAP (
18
+ id integer not null,
19
+ reifier_id integer null,
20
+ title varchar(128) null,
21
+ base_address varchar(512) null,
22
+ comments varchar(2048) null,
23
+ constraint TM_TOPIC_MAP_pkey primary key (id)
24
+ );
25
+
26
+ create table TM_TOPIC_NAME_SCOPE (
27
+ scoped_id integer not null,
28
+ theme_id integer not null,
29
+ constraint TM_TOPIC_NAME_SCOPE_pkey primary key (scoped_id, theme_id)
30
+ );
31
+
32
+ create table TM_TOPIC_NAME (
33
+ id integer not null,
34
+ topic_id integer not null,
35
+ topicmap_id integer not null,
36
+ reifier_id integer null,
37
+ type_id integer null,
38
+ content varchar(2048) null,
39
+ constraint TM_TOPIC_NAME_pkey primary key (id)
40
+ );
41
+
42
+ create table TM_OCCURRENCE (
43
+ id integer not null,
44
+ topic_id integer not null,
45
+ topicmap_id integer not null,
46
+ reifier_id integer null,
47
+ type_id integer null,
48
+ datatype_address varchar(512) null,
49
+ length integer null,
50
+ hashcode integer null,
51
+ content clob null,
52
+ constraint TM_OCCURRENCE_pkey primary key (id)
53
+ );
54
+
55
+ create table TM_ASSOCIATION_SCOPE (
56
+ scoped_id integer not null,
57
+ theme_id integer not null,
58
+ constraint TM_ASSOCIATION_SCOPE_pkey primary key (scoped_id, theme_id)
59
+ );
60
+
61
+ create table TM_ITEM_IDENTIFIERS (
62
+ class varchar(1) not null,
63
+ tmobject_id integer not null,
64
+ topicmap_id integer not null,
65
+ address varchar(512) not null
66
+ );
67
+
68
+ create table TM_ADMIN_SEQUENCE (
69
+ seq_name varchar(32) not null,
70
+ seq_count integer not null,
71
+ constraint TM_ADMIN_SEQUENCE_pkey primary key (seq_name)
72
+ );
73
+
74
+ create table TM_TOPIC (
75
+ id integer not null,
76
+ topicmap_id integer not null,
77
+ reified_id varchar(32) null,
78
+ constraint TM_TOPIC_pkey primary key (id)
79
+ );
80
+
81
+ create table TM_OCCURRENCE_SCOPE (
82
+ scoped_id integer not null,
83
+ theme_id integer not null,
84
+ constraint TM_OCCURRENCE_SCOPE_pkey primary key (scoped_id, theme_id)
85
+ );
86
+
87
+ create table TM_VARIANT_NAME (
88
+ id integer not null,
89
+ name_id integer not null,
90
+ topicmap_id integer not null,
91
+ reifier_id integer null,
92
+ datatype_address varchar(512) null,
93
+ length integer null,
94
+ hashcode integer null,
95
+ content clob null,
96
+ constraint TM_VARIANT_NAME_pkey primary key (id)
97
+ );
98
+
99
+ create table TM_ASSOCIATION (
100
+ id integer not null,
101
+ topicmap_id integer not null,
102
+ reifier_id integer null,
103
+ type_id integer null,
104
+ constraint TM_ASSOCIATION_pkey primary key (id)
105
+ );
106
+
107
+ create table TM_ASSOCIATION_ROLE (
108
+ id integer not null,
109
+ assoc_id integer not null,
110
+ topicmap_id integer not null,
111
+ reifier_id integer null,
112
+ type_id integer null,
113
+ player_id integer null,
114
+ constraint TM_ASSOCIATION_ROLE_pkey primary key (id)
115
+ );
116
+
117
+ create table TM_TOPIC_TYPES (
118
+ topic_id integer not null,
119
+ type_id integer not null,
120
+ constraint TM_TOPIC_TYPES_pkey primary key (topic_id, type_id)
121
+ );
122
+
123
+
124
+ create index TM_SUBJECT_LOCATORS_IX_oa on TM_SUBJECT_LOCATORS(topic_id, address);
125
+ create index TM_SUBJECT_LOCATORS_IX_am on TM_SUBJECT_LOCATORS(address, topic_id);
126
+ create index TM_VARIANT_NAME_SCOPE_IX_hs on TM_VARIANT_NAME_SCOPE(theme_id, scoped_id);
127
+ create index TM_SUBJECT_IDENTIFIERS_IX_oa on TM_SUBJECT_IDENTIFIERS(topic_id, address);
128
+ create index TM_SUBJECT_IDENTIFIERS_IX_am on TM_SUBJECT_IDENTIFIERS(address, topic_id);
129
+ create index TM_TOPIC_MAP_IX_ai on TM_TOPIC_MAP(base_address, id);
130
+ create index TM_TOPIC_NAME_SCOPE_IX_hs on TM_TOPIC_NAME_SCOPE(theme_id, scoped_id);
131
+ create index TM_TOPIC_NAME_IX_o on TM_TOPIC_NAME(topic_id);
132
+ create index TM_TOPIC_NAME_IX_myi on TM_TOPIC_NAME(topicmap_id, type_id, id);
133
+ create index TM_TOPIC_NAME_IX_mvi on TM_TOPIC_NAME(topicmap_id, content, id);
134
+ create index TM_OCCURRENCE_IX_o on TM_OCCURRENCE(topic_id);
135
+ create index TM_OCCURRENCE_IX_myi on TM_OCCURRENCE(topicmap_id, type_id, id);
136
+ create index TM_OCCURRENCE_IX_mhi on TM_OCCURRENCE(topicmap_id, hashcode, id);
137
+ create index TM_ASSOCIATION_SCOPE_IX_hs on TM_ASSOCIATION_SCOPE(theme_id, scoped_id);
138
+ create index TM_ITEM_IDENTIFIERS_IX_o on TM_ITEM_IDENTIFIERS(tmobject_id);
139
+ create index TM_ITEM_IDENTIFIERS_IX_maco on TM_ITEM_IDENTIFIERS(topicmap_id, address, class, tmobject_id);
140
+ create index TM_TOPIC_IX_im on TM_TOPIC(id, topicmap_id);
141
+ create index TM_OCCURRENCE_SCOPE_IX_hs on TM_OCCURRENCE_SCOPE(theme_id, scoped_id);
142
+ create index TM_VARIANT_NAME_IX_o on TM_VARIANT_NAME(name_id);
143
+ create index TM_VARIANT_NAME_IX_mhi on TM_VARIANT_NAME(topicmap_id, hashcode, id);
144
+ create index TM_ASSOCIATION_IX_myi on TM_ASSOCIATION(topicmap_id, type_id, id);
145
+ create index TM_ASSOCIATION_ROLE_IX_o on TM_ASSOCIATION_ROLE(assoc_id);
146
+ create index TM_ASSOCIATION_ROLE_IX_io on TM_ASSOCIATION_ROLE(id, assoc_id);
147
+ create index TM_ASSOCIATION_ROLE_IX_t on TM_ASSOCIATION_ROLE(player_id);
148
+ create index TM_ASSOCIATION_ROLE_IX_it on TM_ASSOCIATION_ROLE(id, player_id);
149
+ create index TM_ASSOCIATION_ROLE_IX_myi on TM_ASSOCIATION_ROLE(topicmap_id, type_id, id);
150
+ create index TM_ASSOCIATION_ROLE_IX_mtyio on TM_ASSOCIATION_ROLE(topicmap_id, player_id, type_id, id, assoc_id);
151
+ create index TM_TOPIC_TYPES_IX_yt on TM_TOPIC_TYPES(type_id, topic_id);
152
+
153
+ insert into TM_ADMIN_SEQUENCE values ('<GLOBAL>', 0);
154
+