Re: documenting a default mapping

Eric,


>
> I think the principle difference is that sql2sw maps to OWL where the
> directGraph stuff maps to RDF.


Once you have the OWL (or RDFS), the RDF (the data) becomes immediate
instances of the ontology. That is trivial to produce


> As an illustration, sql2sw states that
>
> ┌┤Employee├──┬──────┐  ┌┤Address├────┬────────┐
> │ ID │ name  │ addr │  │ ID │ street │ number │
> │ 11 │ Alice │   18 │  │ 18 │ Elm    │    353 │
> └────┴───────┴──────┘  └────┴────────┴────────┘
>
> defines an ontology with e.g. an object property implied by the addr
> attribute and datatype properties implied by the name street and
> number attributes, directGraph takes a more pedestrian approach of
> emitting triples, e.g.
>
>  <stem+Employee/ID.11#_> <stem+Employee#name> "Alice" .
>  <stem+Employee/ID.11#_> <stem+Employee#addr> <stem+Address/ID.18#_> .
>  <stem+Address/ID.18#_> <stem+Employee#street> "Elm" .
>  <stem+Address/ID.18#_> <stem+Employee#number> 353 .
>
> In effect, sql2sw produces an ontology that describes the output of
> directGraph.
>

What is

<stem+Employee#name>

<stem+Employee#addr>

Name is a datatype property with domain Employee and range string
Addr is a object property with domain Employee and range Address

You are implicitly creating the ontology. This needs to be explicit. We need
to know what is the ontology so other people know how to query our dataset,
or how to map it to other ontologies.

>
> > BTW, in the charter, aren't we suppose to have a RIF representation of
> the
> > mapping language. We should be able to easily translate datalog to RIF,
> so
> > this should be a done deal.
> >
> > Cheers,
> >
> > Juan Sequeda
> > +1-575-SEQ-UEDA
> > www.juansequeda.com
> >
> >
> > On Mon, May 31, 2010 at 1:45 AM, Eric Prud'hommeaux <eric@w3.org> wrote:
> >
> > > Noting Irina Astrova's "Rules for Mapping SQL Relational Databases to
> > > OWL Ontologies", I suspect it would be useful to write down a base
> > > case transformation from relations to RDF, analogous to D2R's minimal
> > > configuration for relations with single primary keys. Following is an
> > > algebra and an explaination for that:
> > >
> > > Suppose we want to RDF-ize a relation R:
> > >  R:relation := (name:string, data:set(T:tuple))†
> > >  T := set (A:attribute)
> > >  attributes := (name:string, value:string,
> > > function:null|pk|reference|scalar)
> > > meaning attributes are SQL NULL, a primary key, a foreign key, or
> > > scalar values. (Yes, this minimal mapping precludes attributes from
> > > being both primary AND foreign keys.)
> > >
> > > RDFr(R)    := set (RDFt(T) for each T in R.data)
> > > RDFt(T)    := set (RDFl(S, A) for each scalar A in T)
> > >            + set (RDFn(S, A) for each reference A in T) | S =
> > > nodemap(pk(T))
> > > RDFl(S, A) := triple (S, predicatemap(A), literalmap(A))
> > > RDFn(S, A) := triple (S, predicatemap(A), nodemap(A))
> > >
> > > literalmap produces RDF literal with XSD datatypes with this type
> > > mapping TM:
> > >  SQL           XSD
> > >  INT           http://www.w3.org/TR/xmlschema-2/#integer
> > >  FLOAT         http://www.w3.org/TR/xmlschema-2/#float
> > >  DATE          http://www.w3.org/TR/xmlschema-2/#date
> > >  TIME          http://www.w3.org/TR/xmlschema-2/#time
> > >  TIMESTAMP     http://www.w3.org/TR/xmlschema-2/#dateTime
> > >  CHAR          http://www.w3.org/TR/xmlschema-2/#string
> > >  VARCHAR       http://www.w3.org/TR/xmlschema-2/#string
> > >  STRING        http://www.w3.org/TR/xmlschema-2/#string
> > >
> > > literalmap := rdfLiteral(A,value, TM(A.type))
> > >
> > > nodemap and predicate map are lexical transformations producing IRIs,
> > > either hash
> > >  nodemap(A):IRI = IRI(stemURI + "/" + R.name "/" A.name + "." + A.value
> +
> > > "#_")
> > >  predicatemap(A):IRI = IRI(stemURI + "/" + R.name "#" A.name)
> > > or slash-compatible:
> > >  nodemap(A):IRI = IRI(stemURI + "/" + R.name "/" A.name + "/" +
> A.value)
> > >  predicatemap(A):IRI = IRI(stemURI + "/" + R.name "/" A.name)
> > >
> > > † A variant of this algebra with the traditional relation definition
> > >    R:relation := (name:string, header:set(D:definition),
> > > data:multiset(T:tuple))
> > >  was implemented in scala
> > >
> > >
> https://dvcs.w3.org/hg/stemGraph/file/4ace3eb848d4/src/main/scala/Main.scala
> > >  but the extra rigor ensuring consistent attributes provides more noise
> > >  than value to this application.
> > >
> > >
> > > I'd like to get this into a forum for disucssion with rdb2rdf WG and
> > > the broader community. If folks here are interested in this material,
> > > I'll draw up a WG-publishable document. If not, I can make it available
> > > elsewhere. Either way, the feedback will be useful to us.
> > > --
> > > -ericP
> > >
> > >
>
> --
> -ericP
>

Received on Tuesday, 1 June 2010 13:58:33 UTC