Repository navigation
Open
Labels
P1Next up: wrong results, live user pain, unblocksarea:datalogReasoner, rules, reasoningDefaultsbugSomething isn't working as expected
Description
With "reasoning": "owl2rl", a literal derived through rdfs:subPropertyOf (rule prp-spo1) loses its language tag. It comes back as rdf:langString with no language. Two derived values that differ only by language merge into one row.
Reproduced on next. main has the same code.
Reproduction
{
"@context": {
"ex": "http://example.org/",
"owl": "http://www.w3.org/2002/07/owl#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#"
},
"@graph": [
{"@id": "ex:altLabel", "@type": "owl:DatatypeProperty", "rdfs:subPropertyOf": {"@id": "ex:label"}},
{"@id": "ex:otherLabel", "@type": "owl:DatatypeProperty", "rdfs:subPropertyOf": {"@id": "ex:name"}},
{"@id": "ex:nickLabel", "@type": "owl:DatatypeProperty", "rdfs:subPropertyOf": {"@id": "ex:name"}},
{"@id": "ex:bob",
"ex:label": {"@value": "a", "@language": "fr"},
"ex:altLabel": {"@value": "a", "@language": "en"},
"ex:otherLabel": {"@value": "b", "@language": "en"},
"ex:nickLabel": {"@value": "b", "@language": "de"}}
]
}Run this query once with ex:label and once with ex:name as the property:
{
"@context": {"ex": "http://example.org/"},
"select": ["?l", "?lang"],
"where": [{"@id": "ex:bob", "ex:label": "?l"}, ["bind", "?lang", "(lang ?l)"]],
"reasoning": "owl2rl"
}ex:label
- Expected:
"a"@frand"a"@en. - Actual:
"a"@fr, plus{"@value": "a", "@type": "rdf:langString"}withlang="".
ex:name
- Expected:
"b"@enand"b"@de. - Actual: one row,
{"@value": "b", "@type": "rdf:langString"}withlang="".
Cause
There are two causes, and they compound:
- The rule drops the fact's metadata.
fire_sub_propertyinfluree-db-reasoner/src/execute/property_rules.rsbuilds the derived flake withm: None. That metadata holds the language tag and the list position, so a derived literal keeps therdf:langStringdatatype but loses its language. - Deduplication ignores part of the object.
DerivedSetinfluree-db-reasoner/src/execute/derived.rskeys facts by(s, p, hash(value)).try_add,containsandregister_baseall use that key, and it leaves out the datatype, the language tag and the list position. Values that differ only in those are treated as one fact.
Scope
- Checked, not affected:
- sameAs canonicalization (
execute/util.rs) copiesm; - the symmetric, transitive and inverse rules move IRIs only.
- sameAs canonicalization (
- Inferred from the code, not reproduced:
- a list position is dropped the same way;
- values that differ only by datatype, such as
1asxsd:intand1asxsd:long, would merge through the same key.
- Not checked: datalog rule heads.
Metadata
Metadata
Assignees
Labels
P1Next up: wrong results, live user pain, unblocksarea:datalogReasoner, rules, reasoningDefaultsbugSomething isn't working as expected
Activity