Re: From syntactic to interpreted triple

Hi James,

Nice exercise ;-)
Let me try to solve it first for the question that I have asked you. Hence, in 
this case I am assuming that the dataset of the endpoint contains the 
following RDF triple as its initial state.

  :cars :are :bad .

I am assuming that I am allowed to let the endpoint know that we consider the 
URIs :cars and :automobiles to denote to the same thing, which I do by 
inserting a corresponding owl:sameAs triple as follows.

REQUEST 1:

  PREFIX owl: <http://www.w3.org/2002/07/owl#>
  INSERT DATA { :cars owl:sameAs :automobiles }

Next, I am assuming that the endpoint does not have any reasoning 
capabilities. So, I let it know the meaning of owl:sameAs triples and have it 
calculate (some of) the corresponding inferences by doing the following 
request.

REQUEST 2:

  PREFIX owl: <http://www.w3.org/2002/07/owl#>
  CONSTRUCT {
    ?s2 ?p ?o .
  }
  WHERE {
    ?s1 ?p ?o .
    ?s1 owl:sameAs ?s2 .
  }

I am aware that this query covers only a part of the triples that can be 
inferred based on owl:sameAs. However, this part is sufficient for the 
exercise.

Let G be the set of RDF triples that I retrieve as a response to this request. 
Note that, if the triple (:cars,:are,:bad) has been in the dataset of the 
endpoint, then G contains the triple (:automobiles,:are,:bad). I use G to form 
another INSERT DATA request as follows.

REQUEST 3:

  INSERT DATA {
     # here are all the triples from G
  }

Now, I am ready to send my ASK query.

REQUEST 4:

  ASK WHERE { :automobiles :are :bad }

The response to this request will be the boolean value true for any case in 
which the dataset of the endpoint contained the triple (:cars,:are,:bad) as 
its initial state.

So, this works. Let's move on to your actual exercise. Hence, in this case, 
the only data that I am assuming to be available in the initial state of the 
dataset of the endpoint is the one nested triple:

  <<:cars :are :bad>> rdf:type :claim .

First of all, as I already mentioned in my initial response to Thomas, if we 
use a referential-opacity semantics for RDF*, then there must be something in 
this data of yours that indicates that you want to use referential 
transparency for this particular case. In the following, I am assuming that 
the URI :claim is what gives the indication. More precisely, I am assuming 
that the meaning of the class denoted by this URI is as follows. Every 
embedded triple that is stated to be of rdf:type :claim is meant to be treated 
in terms of referential transparency. Hence, if I continue to use owl:sameAs 
to express that two URIs are meant to denote the same thing, then an inference 
rule for :claim can be defined in SPARQL* as follows.

  PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX owl: <http://www.w3.org/2002/07/owl#>
  CONSTRUCT {
    <<?s2 ?p ?o2>> ?mp ?mo .
  }
  WHERE {
    <<?s1 ?p ?o1>> rdf:type :claim .
    <<?s1 ?p ?o1>> ?mp ?mo .
    {
      ?s1 owl:sameAs ?s2 .
      BIND( ?o1 AS ?o2 )
    }
    UNION
    {
      ?o1 owl:sameAs ?o2 .
      BIND( ?s1 AS ?s2 )
    }
    UNION
    {
      ?s1 owl:sameAs ?s2 .
      ?o1 owl:sameAs ?o2 .
    }
  }

Let's call this query Q_rule1. (I am aware of the fact that this query covers 
only the cases of nested triples in which the embedded triple is in the 
subject position. While this is sufficient for the exercise, it should not be 
difficult to see how the query for embedded triples in the object would be 
defined.)
  
Given these preliminaries, I am ready to start the process that you asked me 
to demonstrate. Again, I first let the endpoint know that we consider the URIs 
:cars and :automobiles to denote to the same thing:

REQUEST 1:

  PREFIX owl: <http://www.w3.org/2002/07/owl#>
  INSERT DATA { :cars owl:sameAs :automobiles }

Next, again assuming that there are no reasoning capabilities in the endpoint, 
I can use the query Q_rule1 to have the endpoint calculate the necessary 
inferences:

REQUEST 2:

  Q_rule1

Similar to before, I use the set G of RDF* triples retrieved as a response to 
this request in order to make another INSERT DATA request that inserts all 
these RDF* triples into the dataset of the endpoint.

REQUEST 3:

  INSERT DATA {
     # here are all the triples from G
  }

Now, I am ready to send your ASK query.

REQUEST 4:

  PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  ASK WHERE { <<:automobiles :are :bad>> rdf:type :claim }

The response to this request will be the boolean value true.

We can also do one more exercise: By the definition of :claim that I give 
above, for every embedded triple that is of rdf:type :claim, all nested 
triples with this embedded triples are considered for referential 
transparency. While this behavior may be desired for some use cases, in other 
use cases one may, instead, want the application of referential transparency 
to be restricted only to nested triples that have a specific predicate. The 
property ex:statedBy that I mentioned as an example in my previous email could 
be such a predicate. Hence, we may define a corresponding inference rule as 
per the following SPARQL* query, which I will call Q_rule2.

  PREFIX owl: <http://www.w3.org/2002/07/owl#>
  PREFIX ex: <http://example.org/>
  CONSTRUCT {
    <<?s2 ?p ?o2>> ex:statedBy ?mo .
  }
  WHERE {
    <<?s1 ?p ?o1>> ex:statedBy ?mo .
    {
      ?s1 owl:sameAs ?s2 .
      BIND( ?o1 AS ?o2 )
    }
    UNION
    {
      ?o1 owl:sameAs ?o2 .
      BIND( ?s1 AS ?s2 )
    }
    UNION
    {
      ?s1 owl:sameAs ?s2 .
      ?o1 owl:sameAs ?o2 .
    }
  }

Based on this definition, it is possible to perform a similar sequence of 
requests as before in order to obtain the answer true for the ASK query

  PREFIX ex: <http://example.org/>
  ASK WHERE { <<:automobiles :are :bad>> ex:statedBy :Alice }

for all cases in which the initial state of the dataset of the endpoint 
contains the nested triple

  <<:cars :are :bad>> ex:statedBy :Alice .


Best,
Olaf



On fredag 22 januari 2021 kl. 20:11:59 CET James Anderson wrote:
> good evening;
> 
> > On 2021-01-22, at 18:49:13, Olaf Hartig <olaf.hartig@liu.se> wrote:
> > 
> > On fredag 22 januari 2021 kl. 16:32:57 CET James Anderson wrote:
> >> [...]
> >> to remain with a simple question, if there is dataset which contains the
> >> assertion
> >> 
> >>   <<  :cars :are :bad . >> a :claim .
> >> 
> >> and one were to wish to cause a query of the _sort_
> >> 
> >>  ask where {  <<  :automobiles :are :bad . >> a :claim . }
> >> 
> >> to return true, how would one achieve that?
> > 
> > Also for this question, before I attempt to answer it, I would like to
> > know
> > how you assume to capture the knowledge that the URIs :automobiles and
> > :cars are meant to refer to the same thing?
> > ...
> > Can I assume that the reasoner/query engine has baked in the knowledge
> > that
> > 
> > :automobiles and :cars are meant to refer to the same thing? Or can I
> > :assume
> > 
> > that there is also a second triple that captures this knowledge explicitly
> > (e.g., via owl:sameAs) and the reasoner/query engine understands the
> > meaning of this second triple and can use this meaning to make the
> > inference needed to return true for the query?
> > 
> > Notice that this question is independent of RDF*.
> 
> assume only that you have the facilities of the graph store protocol and the
> sparql protocol to operate on a dataset. the respective endpoints share a
> dataset, which includes the initial rdf* statement as its initial state.
> you can place any combination of requests to these endpoints.
> what would those requests be?

Received on Saturday, 23 January 2021 17:20:48 UTC