
|
If you were logged in you would be able to see more operations.
|
|
Issue reported at http://www.openrdf.org/forum/mvnforum/viewthread?thread=1584
Hi all,
I am experiencing an apparently weird behaviour related to the way statements are added with contexts in a ForwardChainingRDFSInferencer sail.
If I add in a context a statement stating that a given resource has some label, and if later I retrieve all the statements having as subject such resource, I get in the results the original statements listed _two_ times, one with the original context, and one with the NULL context.
On the other hand, if I add in a context a statement stating that a resource has some literal value (or resource - but anyway _not_ using rdfs:label as property), and I retrieve all the statements having as subject such resource, I get in the results the original statement listed just _one_ time (with the original context) - while, on the basis of the previous test, I would have expected having the statement listed two times.
What's the reason motivating the differences in that behaviour? I checked that it happens not only with rdfs:label, but also with a number of properties defined in RDFS - such as comment.
It follows the code demonstrating the behaviour:
================================================
List<Statement> found = null;
Resource subject = null;
Repository repository = new SailRepository(new ForwardChainingRDFSInferencer(new MemoryStore()));
repository.initialize();
ValueFactory vf = repository.getValueFactory();
RepositoryConnection connection = repository.getConnection();
try {
subject = vf.createBNode();
connection.add(
vf.createStatement(
subject,
vf.createURI("http://www.w3.org/2000/01/rdf-schema#label"),
vf.createLiteral("Test")),
vf.createBNode());
found = connection.getStatements(subject, null, null, true).asList();
for (Statement statement : found)
System.out.println(statement);
subject = vf.createBNode();
connection.add(
vf.createStatement(
subject,
vf.createURI("http://example.com#a_property"),
vf.createLiteral("Test")),
vf.createBNode());
System.out.println("-----------------------------");
found = connection.getStatements(subject, null, null, true).asList();
for (Statement statement : found)
System.out.println(statement);
} finally {
connection.close();
}
repository.shutDown();
================================================
which outputs:
================================================
(_:node12vsbdoisx1, http://www.w3.org/2000/01/rdf-schema#label, "Test") [_:node12vsbdoisx2]
(_:node12vsbdoisx1, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://www.w3.org/2000/01/rdf-schema#Resource) [null]
(_:node12vsbdoisx1, http://www.w3.org/2000/01/rdf-schema#label, "Test") [null]
-----------------------------
(_:node12vsbdoisx3, http://example.com#a_property, "Test") [_:node12vsbdoisx4]
(_:node12vsbdoisx3, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://www.w3.org/2000/01/rdf-schema#Resource) [null]
================================================
Regards,
piercarlo
|
|
Issue has been fixed in the trigger table for the RDF Schema inference rules. This table was valid in the absense of contexts, but now prevents statements from being added to new contexts.
The result of RDF Schema inferencing in the way it is currently done appears to be that every statement is duplicated as an inferred statement in the "null" context:
subj pred obj [context] --> pred rdf:type rdf:Property [null] --> pred rdfs:subPropertyOf pred [null]
This last statement combined with the original one infers the original one in the null context.
|
|