What I am trying to do, is represent my SDB and TDB database information, my models, and identify which database is associate with each model. I’d like the Java code to work as transparently as possible, regardless of it using SDB or TDB. I’ll also be running benchmarks using either SDB or TDB for specific models.
Below is my current assembler file. The TDB configuration info is working now (thanks again, Dave). But I am struggling with the definition of a model that is to use SDB, see hoa:ICD9r at the bottom. Also, it would be nice if I could use consistent properties (ja) as much as possible, versus using tdb and sdb, but I can live with it if I need to. There are inconsistencies like ja:modelName and tdb:graphName. (or are these two different things?) I did not see any Java code examples that use the assembler file to do the construction of Model objects in a transparent manner, without explicitly using SDBFactory. Is this possible? Is there a way to map the hoa:tdbstore and hoa:sdbstore items in the assembler file to corresponding Java objects in my Java code? Should I use ja: properties or sdb: properties. Does anything containing RDB refer to the older implementation prior to SDB, or does this just denote a relational database related item? @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . @prefix sdb: <http://jena.hpl.hp.com/2007/sdb#> . @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . @prefix hoa: <http://www.sas.com/hls/hoa#> . hoa:sdbconn rdf:type sdb:SDBConnection ; sdb:sdbType "MySQL" ; sdb:sdbHost "localhost:3306" ; sdb:sdbUser "dave" ; sdb:sdbPassword "jena4me" ; sdb:driver "com.mysql.jdbc.Driver" ; sdb:jdbcURL "jdbc:mysql://localhost:3306/hoa_jena" ; . hoa:sdbstore rdf:type sdb:Store ; sdb:layout "layout2" ; sdb:rdbModelName "HOM_ICD9"; sdb:connection hoa:sdbconn; . [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . tdb:GraphTDB rdfs:subClassOf ja:Model . hoa:tdbstore rdf:type tdb:DatasetTDB ; tdb:location "DB" ; . hoa:ICD9 rdf:type tdb:GraphTDB ; tdb:graphName <http://purl.bioontology.org/ontology/HOM_ICD9/> ; tdb:dataset hoa:tdbstore ; . hoa:ICD9r rdf:type ja:NamedModel ; ja:modelName <http://purl.bioontology.org/ontology/HOM_ICD9/> ; ja:connection hoa:sdbconn ; . With the above, I get the following exception: Exception in thread "main" com.hp.hpl.jena.assembler.exceptions.AssemblerException: caught: com.hp.hpl.jena.rdf.model.impl.ResourceImpl cannot be cast to com.hp.hpl.jena.rdf.model.Literal doing: root: http://www.sas.com/hls/hoa#ICD9r with type: http://jena.hpl.hp.com/2005/11/Assembler#RDBModel assembler class: class com.hp.hpl.jena.assembler.assemblers.RDBModelAssembler at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:126) at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:105) at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:69) at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:37) at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:34) at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup.openModel(AssemblerGroup.java:23) at com.sas.hls.hoa.ontology.Test.main(Test.java:22) Caused by: java.lang.ClassCastException: com.hp.hpl.jena.rdf.model.impl.ResourceImpl cannot be cast to com.hp.hpl.jena.rdf.model.Literal David Jordan Software Developer SAS Institute Inc. Health & Life Sciences, Research & Development Bldg R ▪ Office 4467 600 Research Drive ▪ Cary, NC 27513 Tel: 919 531 1233 ▪ [email protected]<mailto:[email protected]> www.sas.com<http://www.sas.com> SAS® … THE POWER TO KNOW®
