[
https://issues.apache.org/jira/browse/JENA-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Damien Obrist updated JENA-2360:
--------------------------------
Description:
The following sample code reproduces the issue:
{code:java}
public static void main(String[] arguments) {
try {
FileUtils.deleteDirectory(new File("sample-data"));
} catch (IOException e) {
throw new RuntimeException(e);
}
Dataset dataset = TDB2Factory.connectDataset("sample-data");
Txn.executeWrite(dataset, () -> {
// TDB: 'listStatement' returns no result
Model model = dataset.getDefaultModel();
// in-memory: 'listStatement' returns statement
//Model model = ModelFactory.createDefaultModel();
model.add(
ResourceFactory.createResource("http://www.test.com/my-graph"),
RDF.type,
ResourceFactory.createTypedLiteral("2", XSDDatatype.XSDdecimal)
);
Statement stmt1 = model.listStatements().next();
StmtIterator stmts = model.listStatements(stmt1.getSubject(),
stmt1.getPredicate(), stmt1.getObject());
while (stmts.hasNext())
System.out.println(stmts.next());
});
} {code}
The behaviour is as follows:
* When running the code with Jena 5.1.0, the second {{listStatements}} call
returns no result and nothing is printed
* When running the code with Jena 5.0.0, the second {{listStatements}} call
returns the expected statement and the following is printed:
{code:none}
[http://www.test.com/my-graph, http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
"2"^^xsd:decimal|http://www.test.com/my-graph,%20http://www.w3.org/1999/02/22-rdf-syntax-ns#type,%20%222%22^^xsd:decimal]
{code}
Note that when using the in-memory model instead of the TDB one, then with both
Jena 5.0.0 and 5.1.0 the second {{listStatements}} call returns the expected
statement and prints the above message.
was:
The following sample code reproduces the issue:
{code:java}
public static void main(String[] arguments) {
try {
FileUtils.deleteDirectory(new File("sample-data"));
} catch (IOException e) {
throw new RuntimeException(e);
}
Dataset dataset = TDB2Factory.connectDataset("sample-data");
Txn.executeWrite(dataset, () -> {
// TDB: 'listStatement' returns no result
Model model = dataset.getDefaultModel();
// in-memory: 'listStatement' returns statement
//Model model = ModelFactory.createDefaultModel();
model.add(
ResourceFactory.createResource("http://www.test.com/my-graph"),
RDF.type,
ResourceFactory.createTypedLiteral("2", XSDDatatype.XSDdecimal)
);
Statement stmt1 = model.listStatements().next();
StmtIterator stmts = model.listStatements(stmt1.getSubject(),
stmt1.getPredicate(), stmt1.getObject());
while (stmts.hasNext())
System.out.println(stmts.next());
});
} {code}
The behaviour is as follows:
* When running the code with Jena 5.1.0, the second {{listStatements}} call
returns no result and nothing is printed
* When running the code with Jena 5.0.0, the second {{listStatements}} call
returns the expected statement and the following is printed:
{{[http://www.test.com/my-graph,
http://www.w3.org/1999/02/22-rdf-syntax-ns#type, "2"^^xsd:decimal]}}
Note that when using the in-memory model instead of the TDB one, then with both
Jena 5.0.0 and 5.1.0 the second {{listStatements}} call returns the expected
statement and prints the above message.
> No result when listing specific statement using TDB
> ---------------------------------------------------
>
> Key: JENA-2360
> URL: https://issues.apache.org/jira/browse/JENA-2360
> Project: Apache Jena
> Issue Type: Bug
> Components: TDB2
> Affects Versions: Jena 5.1.0
> Reporter: Damien Obrist
> Priority: Minor
>
> The following sample code reproduces the issue:
>
> {code:java}
> public static void main(String[] arguments) {
> try {
> FileUtils.deleteDirectory(new File("sample-data"));
> } catch (IOException e) {
> throw new RuntimeException(e);
> }
> Dataset dataset = TDB2Factory.connectDataset("sample-data");
> Txn.executeWrite(dataset, () -> {
> // TDB: 'listStatement' returns no result
> Model model = dataset.getDefaultModel();
> // in-memory: 'listStatement' returns statement
> //Model model = ModelFactory.createDefaultModel();
> model.add(
> ResourceFactory.createResource("http://www.test.com/my-graph"),
> RDF.type,
> ResourceFactory.createTypedLiteral("2", XSDDatatype.XSDdecimal)
> );
> Statement stmt1 = model.listStatements().next();
> StmtIterator stmts = model.listStatements(stmt1.getSubject(),
> stmt1.getPredicate(), stmt1.getObject());
> while (stmts.hasNext())
> System.out.println(stmts.next());
> });
> } {code}
> The behaviour is as follows:
> * When running the code with Jena 5.1.0, the second {{listStatements}} call
> returns no result and nothing is printed
> * When running the code with Jena 5.0.0, the second {{listStatements}} call
> returns the expected statement and the following is printed:
> {code:none}
> [http://www.test.com/my-graph,
> http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
> "2"^^xsd:decimal|http://www.test.com/my-graph,%20http://www.w3.org/1999/02/22-rdf-syntax-ns#type,%20%222%22^^xsd:decimal]
> {code}
> Note that when using the in-memory model instead of the TDB one, then with
> both Jena 5.0.0 and 5.1.0 the second {{listStatements}} call returns the
> expected statement and prints the above message.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]