You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Simon Gray <si...@hum.ku.dk> on 2021/12/06 07:57:57 UTC
How do you determine whether a triple from a query result has been inferred?
I would like to display inferred triples differently in my UI, but I’m unsure how to programmatically ascertain which triple is from inference and which is raw data. The only way I can think of that might work would be to make a secondary look-up in the raw data graph and compare the difference of the result sets, but I thought maybe there is a utility method or some kind of attached metadata I could use on the individual triple instead.
Re: How do you determine whether a triple from a query result has been inferred?
Posted by Dave Reynolds <da...@gmail.com>.
On 06/12/2021 08:16, Simon Gray wrote:
> I see, thanks for the swift reply.
>
> Would you agree that a decent approach could be making a secondary query into a graph of the raw data, comparing the result sets using set difference/intersection? The main issue I see with this approach is that the execution time effectively becomes N*M which could be a problem for particularly heavy queries.
Yes, you would need to test each result triple for presence in the base
graph. I'm not sure what the indexing structure of in-memory graphs in
Jena is these days but hopefully the index is good enough to bring that
down the more like mlog(n).
If this operation is a significant bottleneck then you could, in
principle, use a bloom filter to speed up the average membership test.
Dave
>
>> Den 6. dec. 2021 kl. 09.08 skrev Dave Reynolds <da...@gmail.com>:
>>
>> On 06/12/2021 07:57, Simon Gray wrote:
>>> I would like to display inferred triples differently in my UI, but I’m unsure how to programmatically ascertain which triple is from inference and which is raw data. The only way I can think of that might work would be to make a secondary look-up in the raw data graph and compare the difference of the result sets, but I thought maybe there is a utility method or some kind of attached metadata I could use on the individual triple instead.
>>
>> Sorry no, there's no triples-with-inference-metadata API in jena.
>>
>> There is the derivations API but that's just for drilling down into single deductions and is way more expensive than a simple test against the base model.
>>
>> With forward inference the deductions are stored separately from the base triples (getDeductionsGraph()) but that doesn't really help you.
>>
>> Dave
>>
>>
>
Re: How do you determine whether a triple from a query result has been inferred?
Posted by Simon Gray <si...@hum.ku.dk>.
I see, thanks for the swift reply.
Would you agree that a decent approach could be making a secondary query into a graph of the raw data, comparing the result sets using set difference/intersection? The main issue I see with this approach is that the execution time effectively becomes N*M which could be a problem for particularly heavy queries.
> Den 6. dec. 2021 kl. 09.08 skrev Dave Reynolds <da...@gmail.com>:
>
> On 06/12/2021 07:57, Simon Gray wrote:
>> I would like to display inferred triples differently in my UI, but I’m unsure how to programmatically ascertain which triple is from inference and which is raw data. The only way I can think of that might work would be to make a secondary look-up in the raw data graph and compare the difference of the result sets, but I thought maybe there is a utility method or some kind of attached metadata I could use on the individual triple instead.
>
> Sorry no, there's no triples-with-inference-metadata API in jena.
>
> There is the derivations API but that's just for drilling down into single deductions and is way more expensive than a simple test against the base model.
>
> With forward inference the deductions are stored separately from the base triples (getDeductionsGraph()) but that doesn't really help you.
>
> Dave
>
>
Re: How do you determine whether a triple from a query result has been inferred?
Posted by Dave Reynolds <da...@gmail.com>.
On 06/12/2021 07:57, Simon Gray wrote:
> I would like to display inferred triples differently in my UI, but I’m unsure how to programmatically ascertain which triple is from inference and which is raw data. The only way I can think of that might work would be to make a secondary look-up in the raw data graph and compare the difference of the result sets, but I thought maybe there is a utility method or some kind of attached metadata I could use on the individual triple instead.
Sorry no, there's no triples-with-inference-metadata API in jena.
There is the derivations API but that's just for drilling down into
single deductions and is way more expensive than a simple test against
the base model.
With forward inference the deductions are stored separately from the
base triples (getDeductionsGraph()) but that doesn't really help you.
Dave