sparql - How to Add Concept of Active/Inactive to SPIN Rules? -


i'm using topbraid composer free edition compose ontologies , spin rules. i'm loading ontologies sesame openrdf workbench using rdf file saved topbraid composer free edition.

i have application spin rules (more precisely, spin constructors) dynamic in terms of of hundreds of rules should apply. find way add concept of "active" or "inactive" spin rules. i'm willing add check each rule in where clause "active" rules. illustrate, suppose create 2 sub-properties of spin:constructor, call them myprefix:activeconstructor , myprefix:inactiveconstuctor.

now want add clause of constructors triple of form:

?thisconstructoruri myprefix:activeconstructor . 

this approach hinges on defining ?thisconstuctoruri. spin sets ?this current instance of class associated rule. there similar uri of rule itslef.

i believe @ present, rules reside @ blank nodes. example, constructors sxxicc:pub7proposal class have following triples 13 constructors viewed in sesame/openrdf workbench:

subject              predicate           object sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox14591 sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox14638 sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox14710 sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox14787 sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox14841 sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox14927 sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox15002 sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox15088 sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox15114 sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox15195 sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox15257 sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox15336 sxxicc:pub7proposal  spin:constructor    _:node1anlqmpiox15377 

what need (i think)

  1. rules able reference (my ?thisconstructoruri idea)
  2. to able name rules when write them (e.g. sxxicci:pub7proposalsecurityclassificationconsistencycheck)

this can activate/deactivate rules one-by-one (or simple extension in arbitrary named groups). ideas on how this?

satisfying 1. above similar spin:violationsource supported constraints can included in spin:constraintviolation. however, i'm quite deliberately using constructors instead of constraints because not want block instantiation of class if has violations.

i'm afraid answer current spin standard , implementations not support , require altering supporting implementation extend standard this.

i've confirmed 1 awkward way activate/deactivate constructors. note i'm using following subproperty structure:

spin:constructor   sxxicc:sxxipub7compliancecheckrule     sxxicc:activesxxipub7compliancecheckrule 

i create following conststructor sxxicc:sxxipub7compliancecheckrule:

# major function identifier invalid. (511 02) construct {     ?this sxxicc:pub7proposalhascompliancemessage "the major function identifier invalid. (511 02)"^^xsd:string . } {     ?this sxxicc:pub7proposal .     ?this sxxicc:pub7proposalhasdataitem ?dataitem511 .     sxxicc:pub7proposal sxxicc:activesxxipub7compliancecheckrule ?thisrule .     ?thisrule rdfs:comment "the major function identifier invalid. (511 02)"^^xsd:string .     ?dataitem511 sxxicc:pub7dataitem511 .     ?dataitem511 sxxicc:pub7dataitemhasstringvalue ?majorfunctionid .     ?this sxxicc:pub7proposalhasdataitem ?dataitem102 .     ?dataitem102 sxxicc:pub7dataitem102 .     ?dataitem102 sxxicc:pub7dataitemhasstringvalue ?serialnumstring .     bind (substr(?serialnumstring, 1, 4) ?orgstring) .     filter (((((?orgstring = substr("af  x"^^xsd:string, 1, 4)) || (?orgstring = substr("ar  x"^^xsd:string, 1, 4))) || (?orgstring = substr("n   x"^^xsd:string, 1, 4))) || (?orgstring = substr("ns  x"^^xsd:string, 1, 4))) || (?orgstring = substr("mc  x"^^xsd:string, 1, 4))) .     filter (!(((((((((((?majorfunctionid = "air operations") || (?majorfunctionid = "ground operations")) || (?majorfunctionid = "sea operations")) || (?majorfunctionid = "space operations")) || (?majorfunctionid = "range operations")) || (?majorfunctionid = "surveillance/reconnaissance")) || (?majorfunctionid = "special operations")) || (?majorfunctionid = "c3")) || (?majorfunctionid = "sustaining operations")) || (?majorfunctionid = "domestic support operations")) || (?majorfunctionid = "other operations"))) . } 

the relevant lines of query activation are:

sxxicc:pub7proposal sxxicc:activesxxipub7compliancecheckrule ?thisrule . ?thisrule rdfs:comment "the major function identifier invalid. (511 02)"^^xsd:string . 

by default, rule cannot produce error message since has superproperty not active subproperty. confirmed asserting sxxicc:pub7proposal dataitem511 set "sight seeing" (not valid major function identifier). constructor did not produce error message.

i ran following sparql update query openrdf workbench "modify/sparql update" change constructor "active":

prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix sxxicc: <http://www.disa.mil/dso/a2i/ontologies/pbsm/interface/sxxicompliancecheck#> prefix owl: <http://www.w3.org/2002/07/owl#> prefix sp: <http://spinrdf.org/sp#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix smf: <http://topbraid.org/sparqlmotionfunctions#> prefix fn: <http://www.w3.org/2005/xpath-functions#> prefix spl: <http://spinrdf.org/spl#> prefix spin: <http://spinrdf.org/spin#> prefix arg: <http://spinrdf.org/arg#> prefix sxxicompliancecheckindividuals: <http://www.disa.mil/dso/a2i/ontologies/pbsm/interface/sxxicompliancecheckindividuals#> prefix sxxicci: <http://www.disa.mil/dso/a2i/ontologies/pbsm/interface/sxxicompliancecheckindividuals#> prefix xsd: <http://www.w3.org/2001/xmlschema#> prefix bugs: <http://www.disa.mil/dso/a2i/ontologies/pbsm/interface/bugreproduction#> prefix bugreproduction: <http://www.disa.mil/dso/a2i/ontologies/pbsm/interface/bugreproduction#> prefix bugsi: <http://www.disa.mil/dso/a2i/ontologies/pbsm/interface/bugreproductioninstantiations#> prefix bugreproductioninstantiations: <http://www.disa.mil/dso/a2i/ontologies/pbsm/interface/bugreproductioninstantiations#>  insert {     sxxicc:pub7proposal sxxicc:activesxxipub7compliancecheckrule ?thisrule . } {     sxxicc:pub7proposal sxxicc:sxxipub7compliancecheckrule ?thisrule .     ?thisrule rdfs:comment "the major function identifier invalid. (511 02)"^^xsd:string . } 

i asserted identical sxxicc:pub7proposal (different iri), , rule did indeed complain "sight seeing" not valid major function identifier, expected.

note query of same form delete clause replacing above insert clause (identical triple) dynamically inactive constructor. more precisely, prevent error message being generated again.

this inefficient way accomplish dynamic activating , deactivating of constructors. i'm doing lot of work go around blank nodes anchor constructors. i'm using rule's comment assure uniqueness, , i'm using own subproperty constrain scope of rule's search itself. i'd love have better way dynamically activate/deactivate constructor rules without loading/unloading them entirely. great if rule engine understood concept of "active" "inactive" rules not needlessly run find inactive.


Comments