- From: Martynas Jusevičius <martynas@atomgraph.com>
- Date: Wed, 11 Sep 2019 17:45:46 +0200
- To: Mikael Pesonen <mikael.pesonen@lingsoft.fi>
- Cc: public-declarative-apps@w3.org
Hi Mikael, thanks for reaching out. There is more information on LDT in the AtomGraph Processor wiki, more specifically: https://github.com/AtomGraph/Processor/wiki/Linked-Data-Templates The matching is based on URIs: relative request URI is being matched against the ldt:match values of templates in the ontology. Then, from the matching template (if there is any), the SPARQL command is retrieved using either ldt:query or ldt:update (depending on the HTTP request method). To address your example, templates and queries could look like this: :BasicPersonItem a ldt:Template ; ldt:match "/person/basic/{id}" ; ldt:query :ConstructBasicPerson ; rdfs:isDefinedBy : . :ConstructBasicPerson a sp:Construct ; sp:text """ PREFIX foaf: <http://xmlns.com/foaf/0.1/> CONSTRUCT { ?this a foaf:Person ; foaf:name ?name . } { ?this a foaf:Person ; foaf:name ?name . } """ ; rdfs:isDefinedBy : . :AdminPersonItem a ldt:Template ; ldt:match "/person/admin/{id}" ; ldt:query :ConstructAdminPerson ; rdfs:isDefinedBy : . :ConstructAdminPerson a sp:Construct ; sp:text """ CONSTRUCT WHERE { ?this ?p ?o } """ ; rdfs:isDefinedBy : . "Basic person" query retrieves only name and type, "admin person" query retrieves all properties. This example requires that basic and admin person resources can be differentiated by their URIs, i.e. "/person/basic/{id}" vs "/person/admin/{id}". It also assumes that persons are documents (since they can be dereferenced over HTTP), which is not kosher re. httpRange-14 [1]. A better solution would have separate resources for persons e.g. using hash URIs such as #this) and explicitly connect them to documents using an RDF property. We use foaf:primaryTopic/foaf:isPrimaryTopicOf. But this is a whole topic on its own. If you cannot distinguish "basic person" from "admin person" by their URIs, you could also have a template that matches both and maps to a single query. The question is then whether you can differentiate which properties to return using a single query. Does this help? [1] https://www.w3.org/2001/tag/group/track/issues/14 Martynas atomgraph.com On Wed, Sep 11, 2019 at 11:21 AM Mikael Pesonen <mikael.pesonen@lingsoft.fi> wrote: > > > Hi Martynas, > > we have a proprietary implementation now: > > js/React app generates a custom json out of form data. That is sent > (with a template id) to also custom proxy, which converts the json into > SPARQL using pre made templates. SPARQL is then queried on Apache Jena. > > Now we would like to replace all custom bits with one ore more standards. > > Is it possible to have any kind of templates with LDT? For example > "person_basic" and "person_admin", > where admin contains more properties of a person? > > I'm still having trouble to understand how the SPARQL template is > selected with LDT. > > Br, > Mikael > > On 10/09/2019 15:50, Martynas Jusevičius wrote: > > Hey Mikael, > > > > we have a simple example here: https://github.com/AtomGraph/Processor#example > > > > Do you have some specific use case in mind? If you can share it, I can > > probably look into it. > > > > There is a Community Group for Linked Data Templates which includes a > > mailing list: https://www.w3.org/community/declarative-apps/ > > > > Martynas > > atomgraph.com > > > > On Tue, Sep 10, 2019 at 1:27 PM Mikael Pesonen > > <mikael.pesonen@lingsoft.fi> wrote: > >> > >> In the example there is the GET request > >> > >> GET /people/Berners-Lee?g=http%3A%2F%2Flinkeddatahub.com%2Fgraphs%2Fc5f34fe9-0456-48e8-a371-04be71529762 HTTP/1.1 > >> > >> > >> Often you want to query different amounts of data depending of the case. Sometimes for example, person name is enough, other time you want all the triples (DESCRIBE). > >> How do you specify here the context? > >> > >> BTW is there a dedicated forum for discussing Linked Data Templates? > > -- > Lingsoft - 30 years of Leading Language Management > > www.lingsoft.fi > > Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books > > Mikael Pesonen > System Engineer > > e-mail: mikael.pesonen@lingsoft.fi > Tel. +358 2 279 3300 > > Time zone: GMT+2 > > Helsinki Office > Eteläranta 10 > FI-00130 Helsinki > FINLAND > > Turku Office > Kauppiaskatu 5 A > FI-20100 Turku > FINLAND >
Received on Wednesday, 11 September 2019 15:46:23 UTC