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();
> }
>
> }
>
> }
>
>
>
>