Search the web
Sign In
New User? Sign Up
jena-dev · Jena Developers
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Using Assembler with TDB backed model cause ClassCastException   Message List  
Reply | Forward Message #40667 of 42071 |
Re: [jena-dev] Re: Using Assembler with TDB backed model cause ClassCastException

Sanjay,

Thank you for the complete, minimal example. I've found a problem with
the handling of TDB.symUnionDefaultGraph and will fix it.

Andy



sanjayvenkat2000 wrote:
>
>
>>> Further ARQ path expressions such as ?s rdf:type/rdfs:subClassOf* ?o
>>> that work on Memory models with the data, do not return the same
>>> resultset from the TDB models. I will send you sample data it will help
>>> investigate.
>> Yes please - an example is needed.
>>
>> Andy
>
> Andy
>
> With a bit more testing I realize that this problem only occurs when my domain
ontology containing the subClassOf information is not in the same named graph as
the instance information in a TDB backed dataset. (with 0.8.1 and not svn ).
>
> Thanks for the help
> Sanjay
>
> ======
> domain.n3
> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix owl: <http://www.w3.org/2002/07/owl#> .
> @prefix test: <http://test.com/test#> .
>
> test:Account a owl:Thing .
> test:AssetAccount rdfs:subClassOf test:Account .
> test:LiabilityAccount rdfs:subClassOf test:Account .
> test:CurrentAssetAccount rdfs:subClassOf test:AssetAccount .
> ========
> instance.n3
> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix owl: <http://www.w3.org/2002/07/owl#> .
> @prefix test: <http://test.com/test#> .
>
> test:A1 a test:Account .
> test:A2 a test:AssetAccount .
> test:A3 a test:LiabilityAccount .
> test:A4 a test:CurrentAssetAccount .
>
> =============
>
> public class TestTDB {
>
> public static void main(String[] args){
>
> String testNS = "http://test.com/test#";
>
> Model domain = ModelFactory.createDefaultModel();
> domain.read("file:///domain.n3", "N3");
>
> Model instance = ModelFactory.createDefaultModel();
> instance.read("file:///instance.n3", "N3");
>
> DataSource src = DatasetFactory.create();
> Model domain_instance = ModelFactory.createDefaultModel();
> domain_instance.add(domain);
> domain_instance.add(instance);
>
> src.setDefaultModel(domain_instance);
>
> executePathQuery(src);
>
>
> TDB.getContext().setTrue(TDB.symUnionDefaultGraph);
> TDB.getContext().setTrue(TDB.symLogExec);
> Dataset ds =
TDBFactory.createDataset("/Users/Gyaan/eclipse_workspace_etr/EtrConfiguration/Us\
erDatasetTest/users/");
>
> Model tdbDomain = ds.getNamedModel("urn:test:domain");
> tdbDomain.add(domain);
>
> Model tdbInstance = ds.getNamedModel("urn:test:instance");
> tdbInstance.add(instance);
>
> TDB.sync(ds);
>
> Dataset tdbSrc =
TDBFactory.createDataset("/Users/Gyaan/eclipse_workspace_etr/EtrConfiguration/Us\
erDatasetTest/users/");
> executePathQuery(tdbSrc);
>
> }
>
> public static void executePathQuery(Dataset src){
>
> String[] sparql = {
> "PREFIX rdf: <"+RDF.getURI()+"> " ,
> "PREFIX rdfs: <"+RDFS.getURI()+"> " ,
> "SELECT ?typeUri ?type ",
> "WHERE { " ,
> " ?typeUri rdf:type/rdfs:subClassOf* ?type . ",
> "} ",
> "ORDER BY ?typeUri ",
> "LIMIT 10"
> };
>
> try{
> QueryExecution cqexec = null;
> cqexec = QueryExecutionFactory.create( StringUtils.join("\n",sparql),
Syntax.syntaxARQ, src) ;
> ResultSet results = cqexec.execSelect();
> ResultSetFormatter.out(System.out, results);
> }
> catch(Exception e){
> e.printStackTrace();
> }
>
> }
>
> }
>
>
>
>



Fri Jul 3, 2009 3:12 pm

andyseaborne
Offline Offline
Send Email Send Email

Forward
Message #40667 of 42071 |
Expand Messages Author Sort by Date

Andy I am currently using TDB 0.7.3 and am trying to assemble some Java object based on configuration stored in a TDB dataset with the following symbol. ...
sanjayvenkat2000
sanjayvenkat...
Offline Send Email
Jun 30, 2009
3:03 pm

Sorry - I have the wrong stack trace attached earlier. Here is the correct stack trace. 280 java.lang.ClassCastException:...
sanjayvenkat2000
sanjayvenkat...
Offline Send Email
Jun 30, 2009
3:14 pm

Sanjay, Could you try with TDB 0.7.5 or preferrably with TDB in SVN (you need to tweak the constant in SystemTDB.LenNodeHash to use with 0.7 datasets). This...
Andy Seaborne
andyseaborne
Offline Send Email
Jun 30, 2009
4:37 pm

... I upgraded to TDB 0.8.1 from the maven repo and recreated by datastore. That fixed classCastException issue. However, I am having problems with the...
sanjayvenkat2000
sanjayvenkat...
Offline Send Email
Jun 30, 2009
5:47 pm

... This is fixed in SVN - I was working on it on Monday. It's the use of the non-TDB dataset implicit in QueryExecutionFactory.create on a model. ... Yes...
Andy Seaborne
andyseaborne
Offline Send Email
Jun 30, 2009
9:43 pm

... Andy With a bit more testing I realize that this problem only occurs when my domain ontology containing the subClassOf information is not in the same named...
sanjayvenkat2000
sanjayvenkat...
Offline Send Email
Jul 1, 2009
11:01 pm

Sanjay, Thank you for the complete, minimal example. I've found a problem with the handling of TDB.symUnionDefaultGraph and will fix it. Andy...
Andy Seaborne
andyseaborne
Offline Send Email
Jul 3, 2009
3:17 pm

Fixed in TDB SVN. (Fixing this has made a lot of things to do with merged union graphs much cleaner with more cleanly separated responsibilities - thanks for...
Andy Seaborne
andyseaborne
Offline Send Email
Jul 5, 2009
4:24 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help