- From: Holger Knublauch <holger@topquadrant.com>
- Date: Wed, 6 Nov 2019 16:05:04 +1000
- To: "Cox, Simon (L&W, Clayton)" <Simon.Cox@csiro.au>, Simon Steyskal <simon.steyskal@gmail.com>, Semantic Web <semantic-web@w3.org>
- Message-ID: <6a4152e2-6f13-3315-3d97-e0fbf3c42d1d@topquadrant.com>
On 6/11/2019 15:06, Cox, Simon (L&W, Clayton) wrote: > Thanks Simon – yeah, I had seen that and had a go at getting it > running in TBCME, but failed ☹ > > The doco didn’t help me get over that hump (a couple of years ago now > tho.) > Just as a quick pointer: open TopBraid/Examples/schemashacl-violations.ttl and press the Run Inferences button. An example SPARQL rule is defined using sh:rule at schema:Person. On the more general topic: given that SPARQL is a well-established mechanism to construct triples, it makes sense to build RDF vocabularies to share (reusable) SPARQL queries. SPIN contains a concept of "templates" that are able to encapsulate parameterized SPARQL queries, including CONSTRUCT queries. So it could indeed be used to cover some of the requirements discussed in this thread here. However, SHACL rules would not currently be a suitable template language. The charter of the original W3C data shapes WG was to define a validation language, and adding rules as an extra deliverable was already quite an effort. Having said this, most pieces of the puzzle for using SHACL to describe CONSTRUCT templates are already in the vocabulary, and it would be a straight-forward exercise to wrap them into a template language. The main thing to introduce would be a class such as dash:SPARQLConstructTemplate rdf:type rdfs:Class ; rdfs:comment "Encapsulates one or more SPARQL CONSTRUCT queries that can be parameterized. Parameters will become pre-bound variables in the queries." ; rdfs:label "SPARQL CONSTRUCT template" ; rdfs:subClassOf sh:Parameterizable ; rdfs:subClassOf sh:SPARQLConstructExecutable ; . which can then be instantiated as templatetest:CreateRootClassTemplate rdf:type dash:SPARQLConstructTemplate ; rdfs:comment "Creates a new OWL class as a subclass of Thing, with a provided label." ; rdfs:label "Create root class template" ; sh:construct """ CONSTRUCT { ?class a owl:Class . ?class rdfs:subClassOf owl:Thing . ?class rdfs:label $label . } WHERE { BIND (IRI(CONCAT(\"http://example.org/\", ENCODE_FOR_URI($label))) AS ?class) . } """ ; sh:parameter [ rdf:type sh:Parameter ; sh:path templatetest:label ; sh:datatype xsd:string ; sh:description "The label of the new class." ; sh:name "label" ; ] ; sh:prefixes <http://example.org/templatetest> . You can see the vocabulary to declare parameters (sh:parameter, sh:datatype etc) is already there in SHACL, as are the terms for representing SPARQL queries (sh:construct, sh:prefixes etc), and the pre-binding mechanism to use parameter values in the executing queries. Such templates above could have multiple sh:construct values, and we could add a simple mechanism to compose templates from other templates, allowing to assemble templates like lego building blocks. If there is interest in such a mechanism, I could write it up some more and add it to the SHACL API for execution. It would also become one of the last missing pieces for users to transition from SPIN to SHACL. Regards, Holger > *From:* Simon Steyskal <simon.steyskal@gmail.com> > *Sent:* Wednesday, 6 November, 2019 15:54 > *To:* Martin G. Skjæveland <martige@ifi.uio.no>; Cox, Simon (L&W, > Clayton) <Simon.Cox@csiro.au> > *Cc:* Chris Mungall <cjmungall@lbl.gov>; Dan Brickley > <danbri@danbri.org>; Martynas Jusevičius <martynas@atomgraph.com>; > Semantic Web <semantic-web@w3.org>; holger@topquadrant.com > *Subject:* Re: [ANN] OTTR: RDF/OWL modelling framework release, ISWC > tutorial > > @Simon Cox <mailto:simon.cox@csiro.au> > > > SPIN had the advantage that it supported SPARQL CONSTRUCT. > > This is still hinted at in SHCAL but I haven’t found it implemented. > > @Martin G. Skjæveland <mailto:martige@ifi.uio.no> > > > As already pointed out in this thread, SHACL and ShEX, as constraint > > languages, do not support /generating/ patterns, "only" describing > > them. SPIN on the other hand is a more generic language that as a rule > > language also supports generating patterns. > > SHACL Rules (similar to SPIN Rules): > > Defined here -> https://www.w3.org/TR/shacl-af/#rules (not part of the > core SHACL Rec., but published as W3C Note) > > Implemented e.g., by TopBraid's SHACL API -> > https://github.com/TopQuadrant/shacl > > (pinging @Holger Knublauch <mailto:holger@topquadrant.com> for that > matter) > > - simon > > Am Di., 5. Nov. 2019 um 20:31 Uhr schrieb Martin G. Skjæveland > <martige@ifi.uio.no <mailto:martige@ifi.uio.no>>: > > As already pointed out in this thread, SHACL and ShEX, as constraint > languages, do not support /generating/ patterns, "only" describing > them. SPIN on the other hand is a more generic language that as a rule > language also supports generating patterns. > > OTTR has a more narrow focus than SPIN, aiming to be language for > representing reusable modelling patterns for RDF and OWL. These > templates are intended to be made available in libraries of > interconnected templates. OTTR templates are compositional in design, > meaning a template is defined based on other templates -- "it's > templates all the way down". A template instance is "transformed" to > RDF by recursively expanding the instance to instances of the /base > template/ ottr:Triple, which represents an RDF triple. The relative > simple structure of OTTR templates permits automatic analysis of > template libraries to discover possibly unwanted redundancies like > overlap or containment between templates. Other possibly > distinguishing features of OTTR are a custom-built type system that is > used to type check template definitions and instances and can for > instance be used to disallow punning, and list arguments to support > variable length arguments. > > This is an example of an OTTR template representing a pattern > implicitly used in the Pizza ontology: > > ex:NamedPizza [ owl:Class ?pizza, > ? owl:NamedIndividual ?country, > NEList<ottr:IRI> ?toppings] :: { > ax:SubClassOf(?pizza, ex:NamedPizza), > ax:SubObjectHasValue(?pizza, ex:hasCountryOfOrigin, ?country), > ax:SubObjectAllValuesFrom(?pizza, ex:hasTopping, _:toppingsUnion), > rstr:ObjectUnionOf(_:toppingsUnion, ?toppings), > cross | ax:SubObjectSomeValuesFrom(?pizza, ex:hasTopping, > ++?toppings) > } . > > and these are two instances of the template: > > ex:NamedPizza(ex:Margherita, ex:Italy, (ex:Mozzarella, ex:Tomato)) . > ex:NamedPizza(ex:Hawaii, none, (ex:Cheese, ex:Ham, ex:Pineapple)) . > > These are found in the interactive examples on http://ottr.xyz > <http://ottr.xyz>. Click > "Run" to see their expansion. > > OTTR at its core does not support manipulating terms, e.g., > concatenating two strings to form a URI. While this is of course a > necessary feature, we believe it should not be part of the *modelling > pattern* as this makes the pattern description in many cases too > specific to the input data. Data cleansing and preparation we believe > should be placed outside the template. (To support data ingestion, we > have introduced a simple mapping language that translates query > answers to OTTR template instances --- allowing for data preparation > in the query over the sources, see > http://spec.ottr.xyz/pOTTR/0.1/04-etl-bottr.html.) > > We believe that the design of OTTR makes these templates easy to use > and maintain, but we have yet to evaluate this. Our belief is that > OTTR templates are well suited especially for large scale/long term > ontology development as the availability of a well managed library of > reusable and instantiable modelling patterns will pay off in the long > run. An initial library of basic patterns are available, and > maintenance procedures for template libraries are in development. > > Martin > > On 05/11/2019 06:47, Cox, Simon (L&W, Clayton) wrote: > > SPIN had the advantage that it supported SPARQL CONSTRUCT. > > > > This is still hinted at in SHCAL but I haven’t found it implemented. > > > > *From:* Chris Mungall <cjmungall@lbl.gov <mailto:cjmungall@lbl.gov>> > > *Sent:* Tuesday, 5 November, 2019 12:25 > > *To:* Dan Brickley <danbri@danbri.org <mailto:danbri@danbri.org>> > > *Cc:* Simon Steyskal <simon.steyskal@gmail.com > <mailto:simon.steyskal@gmail.com>>; Martin G. Skjæveland > > <martige@ifi.uio.no <mailto:martige@ifi.uio.no>>; Martynas > Jusevičius <martynas@atomgraph.com <mailto:martynas@atomgraph.com>>; > > Semantic Web <semantic-web@w3.org <mailto:semantic-web@w3.org>> > > *Subject:* Re: [ANN] OTTR: RDF/OWL modelling framework release, > ISWC > > tutorial > > > > AFAIK shape languages can't be used in a generative capacity. > OTTR seems > > more in the family of templating languages such as OPPL[1], ROBOT > > templates[2], or Dead Simple OWL Design Paterns[3] > > > > [1] https://github.com/owlcs/OPPL2 > > > > [2] http://robot.obolibrary.org/template R.C. Jackson, J.P. > Balhoff, E. > > Douglass, N.L. Harris, C.J. Mungall, and J.A. Overton. ROBOT: A > tool for > > automating ontology workflows. BMC Bioinformatics, vol. 20, July > 2019. > > https://link.springer.com/epdf/10.1186/s12859-019-3002-3 > > > > [3] Dead Simple OWL Design Patterns David Osumi-Sutherland, Melanie > > Courtot, James P. Balhoff and Christopher Mungall Journal of > Biomedical > > Semantics 2017 8:18 DOI:10.1186/s13326-017-0126-0 > > > https://jbiomedsem.biomedcentral.com/articles/10.1186/s13326-017-0126-0 > > > > On Fri, Nov 1, 2019 at 1:45 AM Dan Brickley <danbri@danbri.org > <mailto:danbri@danbri.org> > > <mailto:danbri@danbri.org <mailto:danbri@danbri.org>>> wrote: > > > > Or, for that matter, ShEx? > > > > https://shex.io/ > > > > A good comparison could help clarify the entire design space. > > > > (academics looking for good semweb topics for students, > please take > > note!) > > > > On Fri, 1 Nov 2019 at 05:59, Simon Steyskal > > <simon.steyskal@gmail.com <mailto:simon.steyskal@gmail.com> > <mailto:simon.steyskal@gmail.com > <mailto:simon.steyskal@gmail.com>>> wrote: > > > > or SHACL? > > > > https://www.w3.org/TR/shacl/#sparql-constraint-components > > > > https://www.w3.org/TR/shacl-af/ > > > > - simon > > > > On Fri, 25 Oct 2019, 09:09 Martynas Jusevičius, > > <martynas@atomgraph.com <mailto:martynas@atomgraph.com> > <mailto:martynas@atomgraph.com <mailto:martynas@atomgraph.com>>> > wrote: > > > > Hi Martin, > > > > how does OTTR compare to SPIN templates? > > https://spinrdf.org/spin.html#spin-templates > > > > > > Martynas > > > > On Fri, Oct 25, 2019 at 5:02 AM Martin G. Skjæveland > > <martige@ifi.uio.no <mailto:martige@ifi.uio.no> > <mailto:martige@ifi.uio.no <mailto:martige@ifi.uio.no>>> wrote: > > > > > > Hi all, > > > > > > Lutra, the open source reference implementation > of OTTR > > templates, is > > > now available in release version 0.6. > > > > > > OTTR (Reasonable Ontology Templates) allows RDF/OWL > > modelling patterns > > > to be precisely defined and instantiated and support > > desirable modelling > > > principles such as > > > > > > - layered abstractions > > > - encapsulating complexity > > > - uniform modelling > > > - DRY don't repeat yourself > > > - separation of design and content > > > > > > Lutra and OTTR supports many convenient language > constructs: > > > - nested template definitions > > > - typing system adapted to RDF and OWL > > > - optional arguments > > > - list arguments > > > and support bulk loading data from spreadsheets and > > databases. > > > > > > To see and learn what this means, visit the > project page: > > > http://ottr.xyz and the primer > > http://spec.ottr.xyz/pOTTR/0.1/ > > > containing many interactive examples. > > > > > > If you are attending ISWC 2019, please come to our > > tutorial "Scalable > > > construction of sustainable knowledge bases" > tomorrow, > > Saturday October > > > 26: http://ottr.xyz/event/2019-10-267-iswc/ > <http://ottr.xyz/event/2019-10-267-iswc/> > > > > > > On behalf of the OTTR team, > > > Martin > > > > > >
Received on Wednesday, 6 November 2019 06:05:14 UTC