From: Gerd M. <ge...@sm...> - 2001-10-04 16:08:54
|
Hi, > I' just wanted to use tm4J with ozone and I had some problems to access > my imported xtm-TopicMaps.... > > // Import XTM Version I > db = ExternalDatabase.openDatabase( dbURL ); > db.reloadClasses(); > try { > OzoneXTMBuilder builder= new OzoneXTMBuilder (db); > builder.buildTopicMap ( > new InputSource( > new FileInputStream(tmFileName))); > .... > } finally { > db.close(); > } > > But HOW can I access it???? 2nd try: buildTopicMap() returns a TopicMap, which is a OzoneObject. Now you could do: db.nameObject( topicmap, "aname" ); and retrieve the topicmap later with: topicmap = (TopicMap)db.objectForName( "aname" ); > // Import XTM Version II > try { > File f= new File ("sampleMap/music-xtm.xml"); > java.io.InputStream inStream=new java.io.FileInputStream (f); > > OzoneTopicMapProviderFactoryImpl > provider=new OzoneTopicMapProviderFactoryImpl(); > if ( provider==null) { > System.err.println ("provider is null"); > } // end of if () > else { > Properties props=new Properties(); > props.setProperty ("dburl",dbURL); > TopicMapProvider p =provider.createTopicMapProvider (props); > p.addTopicMap (inStream,new > java.net.URL("http://tqms.org/sample"),null); > } // end of else > } catch (Exception e) { > System.out.println ("ErrMsg: "+e.getMessage()); > } > > //access TopicMap > try { > OzoneTopicMapProviderFactoryImpl > provider=new OzoneTopicMapProviderFactoryImpl(); > if ( provider==null) { > System.err.println ("provider is null"); > } // end of if () > else { > Properties props=new Properties(); > props.setProperty ("dburl",dbURL); > TopicMapProvider p =provider.createTopicMapProvider (props); > TopicMap topicMap =p.getTopicMap ("http://tqms.org/sample"); > } // end of else > } catch (Exception e) { > System.out.println ("ErrMsg: "+e.getMessage()); > } > > After I tried to access the topicMap I found the following errMsg in the log > of ozoneDB: > > [info] (685) InvokeServer: connection established... > [info] (317) InvokeServer: user logged in: ai114 > [warn] (317) InvokeServer: handleClientException(): java.io.EOFException: > Expecting code > java.io.EOFException: Expecting code > at java.lang.Throwable.<init>(Throwable.java:96) > at java.lang.Exception.<init>(Exception.java:44) > at java.io.IOException.<init>(IOException.java:49) > at java.io.EOFException.<init>(EOFException.java:57) > at java.io.ObjectInputStream.peekCode(ObjectInputStream.java:1557) > at java.io.ObjectInputStream.readObject(ObjectInputStream.java:298) > at java.io.ObjectInputStream.readObject(ObjectInputStream.java:242) > at org.ozoneDB.DxLib.net.DxClient.receive(DxClient.java:107) > at org.ozoneDB.DxLib.net.DxMultiServerClient.run(DxMultiServerClient. > java:44) > at java.lang.Thread.run(Thread.java:498) > [info] (317) InvokeServer: connection closed (user: ai114) > > Do you have any idea? The exception only says that you didn't close the db connection correct and the client application simply exists. But I saw a bug in OzoneTopicMapProviderImpl which I'm going to fix asap. > Btw: I run IBM Jdk 1.3 with Linux, because neither j2sdk1.4.0 nor jdk1.3.1_01 > are working properly with ozone classes. (2561 Segmentation fault) Best Regards, Gerd -- ________________________________________________________________ Gerd Mueller ge...@sm... SMB GmbH http://www.smb-tec.com |