Hi Michael,
given that you want to insert triples, this cannot be done as a (SPARQL)
function. I would probably use SWP, especially if you have multiple
operations or some complicated logic. Another option would be
SPARQLMotion. In both cases, you can invoke them as web services. Would
that work in your case?
An example of an SWP service is attached. It takes one argument
(comment) and inserts that value as rdfs:comment to owl:Thing in the
kennedys ontology. The service would be called like
http://localhost:8083/tbl/swp?_viewClass=updateService:ExampleService&comment=Hello%20World
The code is
updateService:ExampleService
rdf:type ui:Service ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:comment ;
spl:valueType xsd:string ;
rdfs:comment "The comment to add." ;
] ;
ui:prototype """
<ui:setContext ui:queryGraph=\"{=
<http://topbraid.org/examples/kennedys> }\">
<ui:update ui:updateQuery=\"{!
INSERT {
owl:Thing rdfs:comment ?comment .
}
WHERE {
} }\"/>
</ui:setContext>
"""^^ui:Literal ;
rdfs:label "Example service" ;
rdfs:subClassOf ui:JSONServices ;
.
You can use SWP to also do ui:forEach loops, ui:if etc, and run multiple
queries within the same service call. In your case, you could define
additional input arguments and can query them in the WHERE clause.
HTH
Holger
On 21/10/2017 0:20, Michael Johnson wrote:
All,
I have reports that we receive (events, time, place...). I have
modeled these reports in TBC.
I want to create a (function) that I can pass the data (events, time,
place) that will create all of the triples that are necessary.
The easy way would just be to create a method (using jena) and does
simple substitution and an insert.
Seems to me that I should be able to create a SPIN function...but how
do I call this and pass the variable data to it?
We are using a framework called Common Core (based on BFO) that
creates a very rich (and verbose) model. There are dozens of triples
that are created.
We do not need to infer these triples, just insert them.
Any ideas? Any concrete examples/code would be truly appreciated.
Thanks,
Michael
--
You received this message because you are subscribed to the Google
Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "TopBraid
Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# baseURI: http://example.org/updateService
# imports: http://uispin.org/ui
# prefix: updateService
@prefix afn: <http://jena.hpl.hp.com/ARQ/function#> .
@prefix arg: <http://spinrdf.org/arg#> .
@prefix default: <http://uispin.org/default#> .
@prefix fn: <http://www.w3.org/2005/xpath-functions#> .
@prefix let: <http://uispin.org/let#> .
@prefix letrs: <http://uispin.org/letrs#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix smf: <http://topbraid.org/sparqlmotionfunctions#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix spif: <http://spinrdf.org/spif#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix spr: <http://spinrdf.org/spr#> .
@prefix spra: <http://spinrdf.org/spra#> .
@prefix ui: <http://uispin.org/ui#> .
@prefix updateService: <http://example.org/updateService#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://example.org/updateService>
rdf:type owl:Ontology ;
owl:imports <http://uispin.org/ui> ;
owl:versionInfo "Created with TopBraid Composer" ;
.
updateService:ExampleService
rdf:type ui:Service ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:comment ;
spl:valueType xsd:string ;
rdfs:comment "The comment to add." ;
] ;
ui:prototype """
<ui:setContext ui:queryGraph=\"{= <http://topbraid.org/examples/kennedys>
}\">
<ui:update ui:updateQuery=\"{!
INSERT {
owl:Thing rdfs:comment ?comment .
}
WHERE {
} }\"/>
</ui:setContext>
"""^^ui:Literal ;
rdfs:label "Example service" ;
rdfs:subClassOf ui:JSONServices ;
.