I'm wondering if there's a way using Apache Jena or OWL API, to retrieve ontology's individuals by a given data property, and then matching the relations between those individuals from their in common object properties.
EDIT: Here's a sample of the CSV file
,California,Texas,New York,Alabama
Hillary Clinton,69%,31%,33%,67%
Donald Trump,31%,69%,67%,33%
And this is a simple domain ontology created with Protégé:
<?xml version="1.0"?>
<rdf:RDF xmlns="http://www.kdm.com/OWL/elections2016#"
xml:base="http://www.kdm.com/OWL/elections2016"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:elections2016="http://www.kdm.com/OWL/elections2016#">
<owl:Ontology rdf:about="http://www.kdm.com/OWL/elections2016#"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.kdm.com/OWL/elections2016#HasVote -->
<owl:ObjectProperty rdf:about="http://www.kdm.com/OWL/elections2016#HasVote">
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_democratic"/>
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_republic"/>
<rdfs:range rdf:resource="http://www.kdm.com/OWL/elections2016#Votes"/>
</owl:ObjectProperty>
<!-- http://www.kdm.com/OWL/elections2016#HasVoteByClasseSociale -->
<owl:ObjectProperty rdf:about="http://www.kdm.com/OWL/elections2016#HasVoteByClasseSociale">
<rdfs:subPropertyOf rdf:resource="http://www.kdm.com/OWL/elections2016#HasVote"/>
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_democratic"/>
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_republic"/>
<rdfs:range rdf:resource="http://www.kdm.com/OWL/elections2016#ClasseSociale"/>
</owl:ObjectProperty>
<!-- http://www.kdm.com/OWL/elections2016#HasVoteByPeriode -->
<owl:ObjectProperty rdf:about="http://www.kdm.com/OWL/elections2016#HasVoteByPeriode">
<rdfs:subPropertyOf rdf:resource="http://www.kdm.com/OWL/elections2016#HasVote"/>
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_democratic"/>
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_republic"/>
<rdfs:range rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:ObjectProperty>
<!-- http://www.kdm.com/OWL/elections2016#HasVoteByRegion -->
<owl:ObjectProperty rdf:about="http://www.kdm.com/OWL/elections2016#HasVoteByRegion">
<rdfs:subPropertyOf rdf:resource="http://www.kdm.com/OWL/elections2016#HasVote"/>
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_democratic"/>
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_republic"/>
<rdfs:range rdf:resource="http://www.kdm.com/OWL/elections2016#Region"/>
</owl:ObjectProperty>
<!-- http://www.kdm.com/OWL/elections2016#HasVoteByVotingAge -->
<owl:ObjectProperty rdf:about="http://www.kdm.com/OWL/elections2016#HasVoteByVotingAge">
<rdfs:subPropertyOf rdf:resource="http://www.kdm.com/OWL/elections2016#HasVote"/>
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_democratic"/>
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_republic"/>
<rdfs:range rdf:resource="http://www.kdm.com/OWL/elections2016#VotingAge"/>
</owl:ObjectProperty>
<!-- http://www.kdm.com/OWL/elections2016#hasNomineeDemocratic -->
<owl:ObjectProperty rdf:about="http://www.kdm.com/OWL/elections2016#hasNomineeDemocratic">
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Republic"/>
<rdfs:range rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_republic"/>
</owl:ObjectProperty>
<!-- http://www.kdm.com/OWL/elections2016#hasNomineeRepublic -->
<owl:ObjectProperty rdf:about="http://www.kdm.com/OWL/elections2016#hasNomineeRepublic">
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Democratic"/>
<rdfs:range rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_democratic"/>
</owl:ObjectProperty>
<!-- http://www.kdm.com/OWL/elections2016#hasPartone -->
<owl:ObjectProperty rdf:about="http://www.kdm.com/OWL/elections2016#hasPartone">
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Political_parties"/>
<rdfs:range rdf:resource="http://www.kdm.com/OWL/elections2016#Democratic"/>
</owl:ObjectProperty>
<!-- http://www.kdm.com/OWL/elections2016#haspartytwo -->
<owl:ObjectProperty rdf:about="http://www.kdm.com/OWL/elections2016#haspartytwo">
<rdfs:domain rdf:resource="http://www.kdm.com/OWL/elections2016#Republic"/>
<rdfs:range rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_republic"/>
</owl:ObjectProperty>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Data properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.kdm.com/OWL/elections2016#age -->
<owl:DatatypeProperty rdf:about="http://www.kdm.com/OWL/elections2016#age"/>
<!-- http://www.kdm.com/OWL/elections2016#asset -->
<owl:DatatypeProperty rdf:about="http://www.kdm.com/OWL/elections2016#asset"/>
<!-- http://www.kdm.com/OWL/elections2016#currentLocation -->
<owl:DatatypeProperty rdf:about="http://www.kdm.com/OWL/elections2016#currentLocation"/>
<!-- http://www.kdm.com/OWL/elections2016#name -->
<owl:DatatypeProperty rdf:about="http://www.kdm.com/OWL/elections2016#name"/>
<!-- http://www.kdm.com/OWL/elections2016#occupation -->
<owl:DatatypeProperty rdf:about="http://www.kdm.com/OWL/elections2016#occupation"/>
<!-- http://www.kdm.com/OWL/elections2016#spouse -->
<owl:DatatypeProperty rdf:about="http://www.kdm.com/OWL/elections2016#spouse"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.kdm.com/OWL/elections2016#ClasseSociale -->
<owl:Class rdf:about="http://www.kdm.com/OWL/elections2016#ClasseSociale">
<rdfs:subClassOf rdf:resource="http://www.kdm.com/OWL/elections2016#Votes"/>
</owl:Class>
<!-- http://www.kdm.com/OWL/elections2016#Democratic -->
<owl:Class rdf:about="http://www.kdm.com/OWL/elections2016#Democratic">
<rdfs:subClassOf rdf:resource="http://www.kdm.com/OWL/elections2016#Political_parties"/>
</owl:Class>
<!-- http://www.kdm.com/OWL/elections2016#Nominee_democratic -->
<owl:Class rdf:about="http://www.kdm.com/OWL/elections2016#Nominee_democratic">
<rdfs:subClassOf rdf:resource="http://www.kdm.com/OWL/elections2016#Democratic"/>
</owl:Class>
<!-- http://www.kdm.com/OWL/elections2016#Nominee_republic -->
<owl:Class rdf:about="http://www.kdm.com/OWL/elections2016#Nominee_republic">
<rdfs:subClassOf rdf:resource="http://www.kdm.com/OWL/elections2016#Republic"/>
</owl:Class>
<!-- http://www.kdm.com/OWL/elections2016#Periode -->
<owl:Class rdf:about="http://www.kdm.com/OWL/elections2016#Periode">
<rdfs:subClassOf rdf:resource="http://www.kdm.com/OWL/elections2016#Votes"/>
</owl:Class>
<!-- http://www.kdm.com/OWL/elections2016#Political_parties -->
<owl:Class rdf:about="http://www.kdm.com/OWL/elections2016#Political_parties"/>
<!-- http://www.kdm.com/OWL/elections2016#Region -->
<owl:Class rdf:about="http://www.kdm.com/OWL/elections2016#Region">
<rdfs:subClassOf rdf:resource="http://www.kdm.com/OWL/elections2016#Votes"/>
</owl:Class>
<!-- http://www.kdm.com/OWL/elections2016#Republic -->
<owl:Class rdf:about="http://www.kdm.com/OWL/elections2016#Republic">
<rdfs:subClassOf rdf:resource="http://www.kdm.com/OWL/elections2016#Political_parties"/>
</owl:Class>
<!-- http://www.kdm.com/OWL/elections2016#Votes -->
<owl:Class rdf:about="http://www.kdm.com/OWL/elections2016#Votes"/>
<!-- http://www.kdm.com/OWL/elections2016#VotingAge -->
<owl:Class rdf:about="http://www.kdm.com/OWL/elections2016#VotingAge">
<rdfs:subClassOf rdf:resource="http://www.kdm.com/OWL/elections2016#Votes"/>
</owl:Class>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Individuals
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.kdm.com/OWL/elections2016#Alabama -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#Alabama">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Region"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#April -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#April">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#August -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#August">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#Between_18_and_49 -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#Between_18_and_49">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#VotingAge"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#December -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#December">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#DemocraticNominee -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#DemocraticNominee">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Democratic"/>
<name>HillaryClinton</name>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#DonaldTrump -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#DonaldTrump">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_republic"/>
<age rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">70</age>
<asset>4,500,000,000</asset>
<currentLocation>NewYork</currentLocation>
<occupation>Businessman</occupation>
<occupation>MelaniaKnauss</occupation>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#Etudiant -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#Etudiant">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#ClasseSociale"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#February -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#February">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#HillaryClinton -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#HillaryClinton">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Nominee_democratic"/>
<currentLocation>chicago</currentLocation>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#Ingenieur -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#Ingenieur">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#ClasseSociale"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#January -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#January">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#July -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#July">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#June -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#June">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#March -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#March">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#May -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#May">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#New_York -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#New_York">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Region"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#November -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#November">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#October -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#October">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#Over_50 -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#Over_50">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#VotingAge"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#Professeur -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#Professeur">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#ClasseSociale"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#RepublicNominee -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#RepublicNominee">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Republic"/>
<name>Donald Trump</name>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#September -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#September">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Periode"/>
</owl:NamedIndividual>
<!-- http://www.kdm.com/OWL/elections2016#Texas -->
<owl:NamedIndividual rdf:about="http://www.kdm.com/OWL/elections2016#Texas">
<rdf:type rdf:resource="http://www.kdm.com/OWL/elections2016#Region"/>
</owl:NamedIndividual>
</rdf:RDF>
e.g: I'd like to get the inviduals that has a data property value equals to Hillary clinton^^xsd:string and Texas^^xsd:string , and then matching the relations between those individuals from their object properties.
It is possible here a short previous of the 2 steps you need to make it work.
Push your csv file into the ontology. Using owl-api you will have to create 'propertyAssertion' for each value. Using jena, you will have to create a 'statement' for each value.
Add a reasoner to your ontology and transform the pattern you want to "match" into a class expression (OWLClassExpression in the owlapi).
Ask the reasoner for the individuals, properties, classes of the entities that "match" the ClassExpression.
Here a simple example of individual querying using the owlapi reasoning interface an example:
OWLClassExpression expr = OWL.min(OWL.DataProperty("http://myDataProperty"), 1)
namedIndividuals = reasoner.getInstances(expr)
This simple example is a pattern matcher for individuals that have at least one property "http://myDataProperty".
Related
I am creating forms in Orbeon 2021.1.2 PE and I have a problem with handling error calls. I'm creating HTTP service and Action via form builder. I hope to work it out and be able to stay with Builder.
I call API witch works similarly to Twitter, so it returns Error HTTP Status Codes also for business errors (see doc https://developer.twitter.com/ja/docs/basics/response-codes and https://developer.twitter.com/en/docs/twitter-ads-api/response-codes).
For easiest example: if I try to find something a if its not in database, I get code 404 with a detailed error in response body.
I need to get a status code + full body (headers will be good too) to the form. I don't want to use modal windows (witch is default in Orbeon) to handle this call. It disturb users + calls often changes the entire workflow (what is visible, etc.). Some calls are even asynchronous.
What is the best solution to this problem in Orbeon? I tried a few things and find block in several places.
1] Solution through property oxf.fr.detail.process.action-service-error.*.*
Here is set default error modal window. I deleted it and found that I can get some values and write them in the form, for example:
xf:setvalue(ref="//control-1", value="event('response-status-code')")
Specifically, these are the values:
event('error-type')
event('response-status-code')
event('resource-uri')
event('response-headers') - get specific via event('response-headers')[lower-case(name) = 'content-lenght']/value
event('response-body') - This not working, it is still supported?
Because it is a global configuration, I start to working where to put these values. I tried to create my own instance but ended up with the fr:insert() function.
I wanted to create a new instance for each submission and then enter separate values (event ('response-status-code'), ...). However, process with fr:insert() does not work and the documentation has poor example (https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/actions-xforms#xf-insert)
This do what i want, but in form:
<xf:insert context="xxf:instance('HTTP-ERROR-RESULT')" ref="responses" origin="xxf:instance('HTTP-ERROR-TEMPLATE')"/>
I tried to transform it to process, but with no luck:
xf:insert(into="xxf:instance('HTTP-ERROR-RESULT')/reponses", origin="xxf:instance('HTTP-ERROR-TEMPLATE')")
If this is the right way? How to fix my semantic error in xf:insert() and how do I get response-body (event ('response-body') doesn't work...)? And is some way to get name of submission or action in process (I need some id for find in instance).
2] Another way I tried is through xforms-submit-error in submit but it didn't work too.
Under the structure of what the builder creates:
<xf:action event="xforms-submit-done" ev:observer="echo-submission">
<xf:action class="fr-set-control-value-action">
<xf:var name="control-name" value="'control-2'"/>
<xf:var name="control-value" value="/*"/>
</xf:action>
</xf:action>
I tried to insert the something similar but with xforms-submit-error:
<xf:action event="xforms-submit-error" ev:observer="echo-submission">
<xf:action class="fr-set-control-value-action">
<xf:var name="control-name" value="'control-2'"/>
<xf:var name="control-value" value="/*"/>
</xf:action>
</xf:action>
I found that when using class="fr-service" in submission, I cant catch xforms-submit-error. So is the right solution to write the whole submission yourself outside the builder and work with xforms-submit-error?
Or is there an another elegant solution in Orbeon? Thanks for any reply!
Writing your own XForms will give you the most flexibility. You can put that XForms either directly in the form definition, using Edit Source in Form Builder, or in a custom model, which is a file on disk on the server, which I would recommend, see doc.
You seem to have found all the pieces (you did some good research there!), but here is a summary. If you have a service my-service, you can listen to xforms-submit-error, and store the value of event attributes in your own instance. If using a custom model, that file would have the following content, and you can also put the content of the <xf:model> below directly inside the <xf:model> of the form definition through Edit Source in Form Builder. Here the logic just saves the status code in an instance my-error-instance, and then uses an <xf:message> to show if for debugging.
<xf:model xmlns:xf="http://www.w3.org/2002/xforms">
<xf:instance id="my-error-instance">
<_>
<status-code/>
</_>
</xf:instance>
<xf:action observer="my-service-submission" event="xforms-submit-error">
<xf:setvalue
ref="instance('my-error-instance')/status-code"
value="event('response-status-code')"/>
<xf:message value="instance('my-error-instance')/status-code"/>
</xf:action>
</xf:model>
You'll also want to disable the default dialog on errors by setting the following property.
<property as="xs:string" name="oxf.fr.detail.process.action-service-error.*.*"/>
Finally, I put below the full source of a form definition that you can use to test this, with a my-service HTTP service, making a request to http://httpbin.org/status/404, and called for form load, which I used to test the above custom model logic.
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
xmlns:array="http://www.w3.org/2005/xpath-functions/array"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>Calling service returning a 404 on form load</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true" xxf:analysis.calculate="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<grid-1>
<control-1/>
</grid-1>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="grid-1-bind" ref="grid-1" name="grid-1">
<xf:bind id="control-1-bind" name="control-1" ref="control-1" xxf:whitespace="trim"/>
</xf:bind>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance id="fr-form-metadata" xxf:readonly="true" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>a</application-name>
<form-name>a</form-name>
<title xml:lang="en">Calling service returning a 404 on form load</title>
<description xml:lang="en"/>
<created-with-version>2021.1-SNAPSHOT PE</created-with-version>
<library-versions>
<app>4</app>
</library-versions>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments/>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<section-1>
<label>Untitled Section</label>
</section-1>
<control-1>
<label/>
<hint/>
<alert/>
</control-1>
</resource>
</resources>
</xf:instance>
<xf:instance id="my-service-instance" class="fr-service" xxf:exclude-result-prefixes="#all">
<body xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilderXPathApi"><params/></body>
</xf:instance>
<xf:submission id="my-service-submission" class="fr-service"
resource="http://httpbin.org/status/404"
method="get"
serialization="none"
mediatype=""/>
<xf:action id="my-action-binding">
<xf:action event="fr-run-form-load-action-after-controls" ev:observer="fr-form-model"
if="true()">
<xf:send submission="my-service-submission"/>
</xf:action>
<xf:action event="xforms-submit" ev:observer="my-service-submission">
<xf:var name="request-instance-name" value="'my-service-instance'"/>
<xf:action/>
</xf:action>
<xf:action event="xforms-submit-done" ev:observer="my-service-submission"/>
</xf:action>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-section" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid id="grid-1-grid" bind="grid-1-bind">
<fr:c y="1" x="1" w="6">
<xf:input id="control-1-control" bind="control-1-bind">
<xf:label ref="$form-resources/control-1/label"/>
<xf:hint ref="$form-resources/control-1/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</fr:c>
<fr:c y="1" x="7" w="6"/>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
Based on answers from #avernet I make generic handler for xforms-submit-error. First, as was said above, I disable the default dialog by set this property.
<property as="xs:string" name="oxf.fr.detail.process.action-service-error.*.*"/>
Then I put my own custom model to WEB-INF/resources/forms/resources. It's whole look this:
<xf:model xmlns:xf="http://www.w3.org/2002/xforms" id="my-model">
<xf:instance id="my-error-instance">
<reponseList>
</reponseList>
</xf:instance>
<xf:instance id="my-error-template-instance">
<submission name="">
<status-code/>
<uri/>
<date/>
</submission>
</xf:instance>
<xf:action observer="fr-form-model" event="xforms-submit-error">
<xf:insert if="not(exists(xxf:instance('my-error-instance')//submission[#name=event('target')]))" context="xxf:instance('my-error-instance')" ref="reponseList" origin="xxf:instance('my-error-template-instance')"/>
<xf:setvalue if="not(exists(xxf:instance('my-error-instance')//submission[#name=event('target')]))" ref="xxf:instance('my-error-instance')//submission[1]/#name" value="event('target')"/>
<xf:setvalue ref="xxf:instance('my-error-instance')//submission[#name=event('target')]/status-code" value="event('response-status-code')"/>
<xf:setvalue ref="xxf:instance('my-error-instance')//submission[#name=event('target')]/uri" value="event('resource-uri')"/>
<xf:setvalue ref="instance('my-error-instance')//submission[#name=event('target')]/date" value="event('response-headers')[lower-case(name) = 'date']/value"/>
</xf:action>
</xf:model>
Took attention to two conditions (in insert and first setvalue). Because of them model save only last error of one submission. If you want for some reason history, you can delete them.
I would like to infer an anonymous class definition for my Individuals in Protege.
I have a simple Ontology with the Classes Rain NoRain and Scene, The object Property has_weather.
My desire is to be able to infer "has_weather(?x, ?noRain), NoRain(?noRain), Scene(?x) -> (has_weather exactly 0 Rain)(?x) which i wrote in the Rules tab, where i can mix SWRL and OWL Expressions.
I am using Pellet Reasoner, however I also tried with OnTop and Hermit and none works. For example if I do the rule the other way around:
`has_weather(?x, ?noRain), (has_weather exactly 0 Rain)(?x), Scene(?x) -> Test(?x)`
It works without problems.
Is the problem, that Protege just can't infer anonymous classes? Is there any workaround? Thank you in Advance!
here is the code to the ontology
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#has_weather -->
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#has_weather">
<rdfs:subPropertyOf rdf:resource="http://www.w3.org/2002/07/owl#topObjectProperty"/>
</owl:ObjectProperty>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain -->
<owl:Class rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain">
<owl:disjointWith rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Rain"/>
</owl:Class>
<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Rain -->
<owl:Class rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Rain"/>
<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene -->
<owl:Class rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Individuals
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain -->
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain">
<rdf:type rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain"/>
</owl:NamedIndividual>
<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene -->
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene">
<rdf:type rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene"/>
<has_weather rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain"/>
</owl:NamedIndividual>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Rules
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<rdf:Description rdf:about="urn:swrl:var#x">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
</rdf:Description>
<rdf:Description rdf:about="urn:swrl:var#noRain">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
</rdf:Description>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<swrl:body>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#has_weather"/>
<swrl:argument1 rdf:resource="urn:swrl:var#x"/>
<swrl:argument2 rdf:resource="urn:swrl:var#noRain"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain"/>
<swrl:argument1 rdf:resource="urn:swrl:var#noRain"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene"/>
<swrl:argument1 rdf:resource="urn:swrl:var#x"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</swrl:body>
<swrl:head>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#has_weather"/>
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">0</owl:qualifiedCardinality>
<owl:onClass rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Rain"/>
</owl:Restriction>
</swrl:classPredicate>
<swrl:argument1 rdf:resource="urn:swrl:var#x"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</swrl:head>
</rdf:Description>
</rdf:RDF>
`
In general a set of axioms has an infinite amout of entailments. See for example this paper. For this reason reasoners restrict inferences to known classes (not anonymous classes). I suspect this holds true for rules as well.
I therefore suggest you add a class NoRain that you set equivalent to has_weather 0 Rain and change your SWRL rule to use the class NoRain.
When I was trying to add an image to an orbeon form, I found that in some cases works fine, and in other does not.
For example, a simple code with a form that uses a remote image by URL:
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>Form with Image by URL</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all">
<form>
<section-1>
<control-3>http://media2.giphy.com/avatars/aap/gjQXEptJHq99.gif</control-3>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="control-3-bind" ref="control-3" name="control-3" type="xf:anyURI"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>UrlImage</application-name>
<form-name>UrlImage</form-name>
<title xml:lang="en">Form with Image by URL</title>
<description xml:lang="en"/>
<singleton>false</singleton>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<!-- Don't make readonly by default in case a service modifies the resources -->
<xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<section-1>
<label>Untitled Section</label>
</section-1>
<control-3>
<label>This is a remote image</label>
</control-3>
</resource>
</resources>
</xf:instance>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:p="http://www.orbeon.com/oxf/pipeline">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<xf:output id="control-3-control" bind="control-3-bind" mediatype="image/*">
<xf:label ref="$form-resources/control-3/label"/>
<!-- No hint? -->
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:output>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
The important part is the URL http://media2.giphy.com/avatars/aap/gjQXEptJHq99.gif, that works fine. But if you use a secure connection like https://media2.giphy.com/avatars/aap/gjQXEptJHq99.gif is not able to obtain the image.
I am not sure, maybe the problem is similar to this one Trusting all certificates using HttpClient over HTTPS
This is something that can be override by the configuration?
Can I use an image by using the URL from a https site without adding the certificate for each server in my java store?
There are properties to configure that, but you have to be careful, because in general you really shouldn't trust all certificates!
Your example of https://media2.giphy.com/avatars/aap/gjQXEptJHq99.gif works from Chrome without warning or error, for example, so I would expect it to work from the JVM as well. Maybe the JVM is not configured with the same set of CAs as the browser. In which case the JVM can be configured to add some, although it's a bit tricky.
Probably this behaviour is due to Orbeon does not uses the image URL directly, making a intermediate processing in the Orbeon "server-media".
Ok, seems that at the end, it only works if I add the certificate to the keystore of orbeon defined in oxf.http.ssl.keystore.uri. But this is only valid if I know the servers from where the images will be linked. Not a valid solution to link any image from any server. Java allows to disable this behaviour. Is it possible in Orbeon?
This is my first post to stack overflow so I request for an encouraging reply :) (bonus reputations)
I am trying to use SWRL to do some calculations for me. To imitate the problem, I have created a small ontology using protege 4.3. It has only two classes Parent and Son. Instances include 1 parent (John) and three sons (son1, son2, son3). John is linked with 3 sons using "hasSon" object property. Age of each son is mentioned using "hasAge" data-type property (integers).
Question-1: I need to first check that how many instances are linked with a given Parent(John) using hasSon property. How this can be achieved in SWRL?
Question-2: After knowing the number of Sons then I have to add their ages to get the total age of all the Sons again using SWRL?
For me, this require a loop like addition (a=a+b) but I dont know how this will work in SWRL. I have attached the OWL code for you.
(Please note that in actual ontology the linked instances are not 3 but are varying and counting them is part of the problem)
Thanks in advance
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<!ENTITY parenttrial "http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial#" >
]>
<rdf:RDF xmlns="http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial#"
xml:base="http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:parenttrial="http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<owl:Ontology rdf:about="http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial#hasSon -->
<owl:ObjectProperty rdf:about="&parenttrial;hasSon">
<rdfs:domain rdf:resource="&parenttrial;Parent"/>
<rdfs:range rdf:resource="&parenttrial;Son"/>
</owl:ObjectProperty>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Data properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial#hasAge -->
<owl:DatatypeProperty rdf:about="&parenttrial;hasAge"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial#Parent -->
<owl:Class rdf:about="&parenttrial;Parent"/>
<!-- http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial#Son -->
<owl:Class rdf:about="&parenttrial;Son"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Individuals
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial#JohnF -->
<owl:NamedIndividual rdf:about="&parenttrial;JohnF">
<rdf:type rdf:resource="&parenttrial;Parent"/>
<hasSon rdf:resource="&parenttrial;Son1"/>
<hasSon rdf:resource="&parenttrial;Son2"/>
<hasSon rdf:resource="&parenttrial;Son3"/>
</owl:NamedIndividual>
<!-- http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial#Son1 -->
<owl:NamedIndividual rdf:about="&parenttrial;Son1">
<rdf:type rdf:resource="&parenttrial;Son"/>
<hasAge rdf:datatype="&xsd;integer">3</hasAge>
</owl:NamedIndividual>
<!-- http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial#Son2 -->
<owl:NamedIndividual rdf:about="&parenttrial;Son2">
<rdf:type rdf:resource="&parenttrial;Son"/>
<hasAge rdf:datatype="&xsd;integer">4</hasAge>
</owl:NamedIndividual>
<!-- http://www.semanticweb.org/admin/ontologies/2015/7/parenttrial#Son3 -->
<owl:NamedIndividual rdf:about="&parenttrial;Son3">
<rdf:type rdf:resource="&parenttrial;Son"/>
<hasAge rdf:datatype="&xsd;integer">5</hasAge>
</owl:NamedIndividual>
</rdf:RDF>
<!-- Generated by the OWL API (version 3.4.2) http://owlapi.sourceforge.net -->
Answer 1: There is no way through SWRL to check how many instances are connected to a certain property through SWRL. You are better off writing a sparql query with COUNT for this. Alternatively you can use an ontology framework and use an Iteratorto figure out the counts.
Answer 2: There is no way to loop a SWRL rule, perform an operation and return a value. SWRL rules are meant to add extra information about relations and not act as a programming language.
Solution: You are far better off using a ontology framework like Apache Jena or Owl api and writing a program to handle this instead of relying on SWRL. SWRL supports monotonic inferences only and thus cannot be used to loop over data in an ontology. Trying to do so will cause the rule to get executed infinitely.
Instead write a bit of code to do this. Refer to owl api or Jena ontology api and sparql in order to learn more on how to use these technologies.
I have been using Form Builder to stage the deployment of Orbeon Forms.
Ie, I iterate form definitions between FB and Oxygen by copying the code into Form Builder -> Edit Source. Then I save and publish the form definition.
This seemed to work ok in 4.2 (ok - I would lose some comments, not ideal, but not functionality).
I'm now getting a very different situation using 4.3. Saving in Form Builder is removing actual code (not ideal). Has anyone else seen this?
For instance, my code:
<xf:action id="create-job-binding">
<!-- React to event... on control... -->
<xf:action ev:event="DOMActivate" ev:observer="save-job-control" if="true()">
<!-- Service to call -->
<xf:send submission="new-job-submission"/>
</xf:action>
<!-- Request actions -->
<xf:action ev:event="xforms-submit" ev:observer="new-job-submission">
<!-- Get reference to initial request -->
<xf:var name="request-instance-name" value="'new-job-instance'" as="xs:string"/>
<!-- Copy over to read-write request instance -->
<xf:insert ref="instance('fr-service-request-instance')"
origin="saxon:parse(instance($request-instance-name))"/>
<!--<xf:insert ref="instance('fr-service-request-instance')" origin="instance($request-instance-name)"/>-->
<!-- Set values if needed -->
<xf:action context="instance('fr-service-request-instance')">
<xf:action class="fr-set-service-value-action">
<!-- Parameters -->
<xf:var name="control-name" value="'car-id'" as="xs:string"/>
<xf:var name="path" value="/request/car-id" as="xs:string"/>
<!-- Set value -->
<xf:setvalue ref="$path" value="instance('edited-job')/job/*[name() = $control-name]"/>
</xf:action>
<xf:action class="fr-set-service-value-action">
<!-- Parameters -->
<xf:var name="control-name" value="'driver-id'" as="xs:string"/>
<xf:var name="path" value="/request/driver-id" as="xs:string"/>
<!-- Set value -->
<xf:setvalue ref="$path" value="instance('edited-job')/job/*[name() = $control-name]"/>
</xf:action>
<xf:action class="fr-set-service-value-action">
<!-- Parameters -->
<xf:var name="control-name" value="'document'" as="xs:string"/>
<xf:var name="path" value="/request/event-id" as="xs:string"/>
<!-- Set value -->
<xf:setvalue ref="$path"
value="xxf:instance('fr-parameters-instance')/*[name() = $control-name]"/>
</xf:action>
<!-- Setvalue actions will be here -->
</xf:action>
</xf:action>
<!-- Response actions -->
<xf:action ev:event="xforms-submit-done" ev:observer="new-job-submission"
context="instance('fr-service-response-instance')">
<!-- Response actions will be here -->
</xf:action>
</xf:action> `
after saving in FB becomes:
<xf:action id="create-job-binding">
<!-- React to event... on control... -->
<xf:action ev:event="DOMActivate" ev:observer="save-job-control" if="true()">
<!-- Service to call -->
<xf:send submission="new-job-submission"/>
</xf:action>
<!-- Request actions -->
<xf:action ev:event="xforms-submit" ev:observer="new-job-submission">
<!-- Get reference to initial request -->
<xf:var name="request-instance-name" value="'new-job-instance'" as="xs:string"/>
<!-- Copy over to read-write request instance -->
<xf:insert ref="instance('fr-service-request-instance')"
origin="saxon:parse(instance($request-instance-name))"/>
<!--<xf:insert ref="instance('fr-service-request-instance')" origin="instance($request-instance-name)"/>-->
<!-- Set values if needed -->
<xf:action context="instance('fr-service-request-instance')">
<xf:action class="fr-set-service-value-action">
<xf:var name="control-name" value="'car-id'" as="xs:string"/>
<xf:var name="path" value="/request/car-id" as="xs:string"/>
</xf:action>
<xf:action class="fr-set-service-value-action">
<xf:var name="control-name" value="'driver-id'" as="xs:string"/>
<xf:var name="path" value="/request/driver-id" as="xs:string"/>
</xf:action>
<xf:action class="fr-set-service-value-action">
<xf:var name="control-name" value="'document'" as="xs:string"/>
<xf:var name="path" value="/request/event-id" as="xs:string"/>
</xf:action>
<!-- Setvalue actions will be here -->
</xf:action>
</xf:action>
<!-- Response actions -->
<xf:action ev:event="xforms-submit-done" ev:observer="new-job-submission"
context="instance('fr-service-response-instance')">
<!-- Response actions will be here -->
</xf:action>
</xf:action>
Notice loss of the setValue commands.
Also removed xf:help references:
<xh:tr>
<xh:td colspan="2">
<xf:textarea id="pickup-address-control" bind="pickup-address-bind">
<xf:label ref="$form-resources/pickup-address/label"/>
<xf:hint ref="$form-resources/pickup-address/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:textarea>
</xh:td>
<xh:td>
<xf:input id="pickup-postcode-control" bind="pickup-postcode-bind">
<xf:label ref="$form-resources/pickup-postcode/label"/>
<xf:hint ref="$form-resources/pickup-postcode/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td>
<xf:textarea id="notes-control" bind="notes-bind">
<xf:label ref="$form-resources/notes/label"/>
<xf:hint ref="$form-resources/notes/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:textarea>
</xh:td>
</xh:tr>
This appears to be intended behaviour in 4.3 Form Builder/Runner. I maybe should have done a bit more research on 4.3 before posting. Anyway:
Removal of xf:help elements on controls. These are removed if the ref points to an empty element.
Removal of setvalue commands. These are removed if the class of the action is one which is templated in ~/resources/apps/fr/components/actions.xsl (for instance fr-set-control-value-action).
My 4.2 forms didn't work following upgrade because I had edited the source to change the action settings to refer to elements not within the FB context (other instances), but had left the class tag unchanged. Removal of the class tag solved the problem.