Hi Jack,
we may have added exactly what you are referring to in 4.5. There will
be a new feature called "dynamic ranges" that has been designed for
scenarios such as:
- there is a class ex:Address
- with a property ex:country
- and a property ex:state
If the user switches ex:country to ex:Australia then the range of
ex:state is assumed to be ex:ACT, ex:NSW, ex:NT, etc while for ex:USA it
would only allow the US states. This is implemented via a SPIN extension
that includes a SPIN template to be used as a spin:constraint at
owl:Thing. The UI (SWA components) will also understand how to treat
those automatically - and switch to another drop down box depending on
the selected country. Currently these dynamic ranges are limited to
enumerations, e.g. instances of state.
I have attached an example of this design.
How does this scenario compare to what you need?
Holger
On 6/18/2014 8:33, Jack Hodges wrote:
I was wondering if TBC supports the notion of value dependencies. For
example, I might want to say the following:
if <someClass>.<someProperty> has a value, then
<thisClass>.<someOtherProperty> must be in this range
otherwise <thisClass>.<someOtherProperty> must be in this other range.
I have written it as a rule because dependencies generally look like
rules. Does SPIN allow us to capture these kinds of dependencies?
Jack
--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise
Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid
Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
topbraid-users@googlegroups.com
To unsubscribe from this group, send email to
topbraid-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
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 topbraid-users+unsubscr...@googlegroups.com
<mailto:topbraid-users+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary
Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL
Web Pages and SPIN.
To post to this group, send email to
topbraid-users@googlegroups.com
To unsubscribe from this group, send email to
topbraid-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
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 topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
# baseURI: http://spinrdf.org/spl-dynamic-ranges
# imports: http://spinrdf.org/spin
@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 sp: <http://spinrdf.org/sp#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix spl-dynamic-ranges: <http://spinrdf.org/spl-dynamic-ranges#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://spinrdf.org/arg#firstProperty>
rdf:type rdf:Property ;
rdfs:subPropertyOf sp:arg ;
.
<http://spinrdf.org/arg#secondProperty>
rdf:type rdf:Property ;
rdfs:subPropertyOf sp:arg ;
.
spl:DynamicEnumRangeConstraint
rdf:type spin:ConstructTemplate ;
spin:body [
rdf:type sp:Construct ;
sp:templates (
[
sp:object spin:ConstraintViolation ;
sp:predicate rdf:type ;
sp:subject _:b36523 ;
]
[
sp:object [
sp:varName "predicate"^^xsd:string ;
] ;
sp:predicate spin:violationPath ;
sp:subject _:b36523 ;
]
[
sp:object spin:_this ;
sp:predicate spin:violationRoot ;
sp:subject _:b36523 ;
]
[
sp:object [
sp:varName "label"^^xsd:string ;
] ;
sp:predicate rdfs:label ;
sp:subject _:b36523 ;
]
) ;
sp:where (
(
[
sp:object [
sp:varName "object"^^xsd:string ;
] ;
sp:predicate [
sp:varName "predicate"^^xsd:string ;
] ;
sp:subject spin:_this ;
]
[
sp:object [
sp:varName "query"^^xsd:string ;
] ;
sp:predicate spl:dynamicEnumRange ;
sp:subject [
sp:varName "predicate"^^xsd:string ;
] ;
]
[
rdf:type sp:Filter ;
sp:expression [
rdf:type sp:notExists ;
sp:elements (
[
sp:object [
sp:varName "query"^^xsd:string ;
] ;
sp:predicate rdf:first ;
sp:subject [
sp:varName "?0"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "?1"^^xsd:string ;
] ;
sp:predicate rdf:rest ;
sp:subject [
sp:varName "?0"^^xsd:string ;
] ;
]
[
sp:object "this" ;
sp:predicate rdf:first ;
sp:subject [
sp:varName "?1"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "?2"^^xsd:string ;
] ;
sp:predicate rdf:rest ;
sp:subject [
sp:varName "?1"^^xsd:string ;
] ;
]
[
sp:object spin:_this ;
sp:predicate rdf:first ;
sp:subject [
sp:varName "?2"^^xsd:string ;
] ;
]
[
sp:object () ;
sp:predicate rdf:rest ;
sp:subject [
sp:varName "?2"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "object"^^xsd:string ;
] ;
sp:predicate spin:select ;
sp:subject [
sp:varName "?0"^^xsd:string ;
] ;
]
) ;
] ;
]
)
[
rdf:type sp:Bind ;
sp:expression [
rdf:type sp:concat ;
sp:arg1 "Invalid value " ;
sp:arg2 [
rdf:type xsd:string ;
sp:arg1 [
sp:varName "object"^^xsd:string ;
] ;
] ;
sp:arg3 " does not match (dynamic) range of " ;
sp:arg4 [
rdf:type xsd:string ;
sp:arg1 [
sp:varName "predicate"^^xsd:string ;
] ;
] ;
] ;
sp:variable [
sp:varName "label"^^xsd:string ;
] ;
]
) ;
] ;
spin:labelTemplate "Dynamic enum range constraint"^^xsd:string ;
rdfs:comment "Implements a spin:constraint based on declared dynamic enum
ranges. For all properties of the given subject (?this) that have declared a
spl:dynamicEnumRange, it will execute that query (SELECT) and check if the
given property value of ?this is among the values returned by the SELECT.
Constructs a constraint violation otherwise."^^xsd:string ;
rdfs:label "Dynamic enum range constraint"^^xsd:string ;
rdfs:subClassOf spin:ConstructTemplates ;
.
spl:ThisObjectsObjects
rdf:type spin:SelectTemplate ;
spin:body [
rdf:type sp:Select ;
sp:resultVariables (
[
sp:varName "result"^^xsd:string ;
]
) ;
sp:where (
[
sp:object [
sp:varName "object"^^xsd:string ;
] ;
sp:predicate [
sp:varName "firstProperty"^^xsd:string ;
] ;
sp:subject spin:_this ;
]
[
sp:object [
sp:varName "result"^^xsd:string ;
] ;
sp:predicate [
sp:varName "secondProperty"^^xsd:string ;
] ;
sp:subject [
sp:varName "object"^^xsd:string ;
] ;
]
) ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate <http://spinrdf.org/arg#firstProperty> ;
spl:valueType rdf:Property ;
rdfs:comment "The first property to walk, from ?this."^^xsd:string ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate <http://spinrdf.org/arg#secondProperty> ;
spl:valueType rdf:Property ;
rdfs:comment "The second property to walk starting with the values of
?thisProperty."^^xsd:string ;
] ;
spin:labelTemplate "This objects' objects via {?firstProperty} and
{?secondProperty}"^^xsd:string ;
rdfs:comment """Gets all objects that are two steps away from ?this via the
property ?firstProperty and then ?secondProperty.
This template can be used in conjunction with
spl:dynamicEnumRange."""^^xsd:string ;
rdfs:label "This objects' objects"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
.
spl:ThisObjectsSubjects
rdf:type spin:SelectTemplate ;
spin:body [
rdf:type sp:Select ;
sp:resultVariables (
[
sp:varName "result"^^xsd:string ;
]
) ;
sp:where (
[
sp:object [
sp:varName "object"^^xsd:string ;
] ;
sp:predicate [
sp:varName "firstProperty"^^xsd:string ;
] ;
sp:subject spin:_this ;
]
[
sp:object [
sp:varName "object"^^xsd:string ;
] ;
sp:predicate [
sp:varName "secondProperty"^^xsd:string ;
] ;
sp:subject [
sp:varName "result"^^xsd:string ;
] ;
]
) ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate <http://spinrdf.org/arg#firstProperty> ;
spl:valueType rdf:Property ;
rdfs:comment "The first property to walk, from ?this."^^xsd:string ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate <http://spinrdf.org/arg#secondProperty> ;
spl:valueType rdf:Property ;
rdfs:comment "The second property to walk starting with the values of
?thisProperty."^^xsd:string ;
] ;
spin:labelTemplate "This objects' objects via {?firstProperty} and
{?secondProperty}"^^xsd:string ;
rdfs:comment """Gets all subjects that are two steps away from ?this via the
property ?firstProperty and then ?secondProperty.
This template can be used in conjunction with
spl:dynamicEnumRange."""^^xsd:string ;
rdfs:label "This objects' subjects"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
.
spl:dynamicEnumRange
rdf:type rdf:Property ;
rdfs:comment "Can be used to link a property with a SELECT query that returns
the valid values of the property within the given instance (?this). For
example, the values of schema:addressRegion may be \"ACT\", \"NSW\", \"QLD\"
and the other abbreviations of Australian States or Territories if the
schema:addressCountry of the surrounding address has been changed to
Australia."^^xsd:string ;
rdfs:domain rdf:Property ;
rdfs:label "dynamic enum range"^^xsd:string ;
rdfs:range sp:Select ;
rdfs:subPropertyOf spin:query ;
.
spl:dynamicEnumRangeTrigger
rdf:type rdf:Property ;
rdfs:comment """Points to any number of property that impact the computation
of dynamicEnumRanges. For example, if the range of ex:addressRegion changes
whenever ex:addressCountry changes, then ex:addressCountry should be the value
of swa:dynamicEnumRangeTrigger.
Currently the values of this property can only be rdf:Properties. However,
future versions may support different kinds of triggers."""^^xsd:string ;
rdfs:domain rdf:Property ;
rdfs:label "dynamic enum range trigger"^^xsd:string ;
rdfs:range rdf:Property ;
.
<http://spinrdf.org/spl-dynamic-ranges>
rdf:type owl:Ontology ;
rdfs:comment "A module of the SPIN Standard Library (SPL) with support for
dynamic ranges."^^xsd:string ;
owl:imports <http://spinrdf.org/spin> ;
owl:versionInfo "0.1.0"^^xsd:string ;
.
owl:Thing
spin:constraint [
rdf:type spl:DynamicEnumRangeConstraint ;
] ;
.
# baseURI: http://example.org/splDynamicEnumRangeExample
# imports: http://spinrdf.org/spl-dynamic-ranges
@prefix arg: <http://spinrdf.org/arg#> .
@prefix ex: <http://example.org/splDynamicEnumRangeExample#> .
@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 sp: <http://spinrdf.org/sp#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix swa: <http://topbraid.org/swa#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://example.org/splDynamicEnumRangeExample>
rdf:type owl:Ontology ;
rdfs:comment "For a demo of dynamic ranges, go to Model > Open with SWA
Default Application (with TBC-ME) and search for Address. Enter an ex:country
and observe how the valid values for ex:state change."^^xsd:string ;
owl:imports <http://spinrdf.org/spl-dynamic-ranges> ;
owl:versionInfo "Created with TopBraid Composer"^^xsd:string ;
.
ex:ACT
rdf:type ex:AustralianState ;
rdfs:label "ACT"^^xsd:string ;
.
ex:AK
rdf:type ex:USState ;
rdfs:label "AK"^^xsd:string ;
.
ex:AL
rdf:type ex:USState ;
rdfs:label "AL"^^xsd:string ;
.
ex:AR
rdf:type ex:USState ;
rdfs:label "AR"^^xsd:string ;
.
ex:AZ
rdf:type ex:USState ;
rdfs:label "AZ"^^xsd:string ;
.
ex:Address
rdf:type owl:Class ;
rdfs:label "Address"^^xsd:string ;
rdfs:subClassOf owl:Thing ;
.
ex:Address_1
rdf:type ex:Address ;
ex:addressCountry ex:Australia ;
ex:addressPostalCode "4879"^^xsd:string ;
ex:addressState ex:QLD ;
ex:addressStreet "3 Teewah Close"^^xsd:string ;
rdfs:label "Address 1"^^xsd:string ;
.
ex:Address_2
rdf:type ex:Address ;
ex:addressCountry ex:Australia ;
ex:addressPostalCode "2760"^^xsd:string ;
ex:addressState ex:NSW ;
ex:addressStreet "Locked Bag 56, St Marys Delivery Centre"^^xsd:string ;
rdfs:label "Address 2"^^xsd:string ;
.
ex:Australia
rdf:type ex:Country ;
ex:state ex:ACT ;
ex:state ex:NSW ;
ex:state ex:NT ;
ex:state ex:QLD ;
ex:state ex:SA ;
ex:state ex:TAS ;
ex:state ex:VIC ;
rdfs:label "Australia"^^xsd:string ;
.
ex:AustralianState
rdf:type owl:Class ;
rdfs:label "Australian state"^^xsd:string ;
rdfs:subClassOf ex:State ;
.
ex:CA
rdf:type ex:USState ;
rdfs:label "CA"^^xsd:string ;
.
ex:CO
rdf:type ex:USState ;
rdfs:label "CO"^^xsd:string ;
.
ex:CT
rdf:type ex:USState ;
rdfs:label "CT"^^xsd:string ;
.
ex:Country
rdf:type owl:Class ;
rdfs:label "Country"^^xsd:string ;
rdfs:subClassOf owl:Thing ;
.
ex:DE
rdf:type ex:USState ;
rdfs:label "DE"^^xsd:string ;
.
ex:FA
rdf:type ex:USState ;
rdfs:label "FA"^^xsd:string ;
.
ex:FL
rdf:type ex:USState ;
rdfs:label "FL"^^xsd:string ;
.
ex:HI
rdf:type ex:USState ;
rdfs:label "HI"^^xsd:string ;
.
ex:IA
rdf:type ex:USState ;
rdfs:label "IA"^^xsd:string ;
.
ex:ID
rdf:type ex:USState ;
rdfs:label "ID"^^xsd:string ;
.
ex:IL
rdf:type ex:USState ;
rdfs:label "IL"^^xsd:string ;
.
ex:IN
rdf:type ex:USState ;
rdfs:label "IN"^^xsd:string ;
.
ex:KS
rdf:type ex:USState ;
rdfs:label "KS"^^xsd:string ;
.
ex:KY
rdf:type ex:USState ;
rdfs:label "KY"^^xsd:string ;
.
ex:LA
rdf:type ex:USState ;
rdfs:label "LA"^^xsd:string ;
.
ex:MA
rdf:type ex:USState ;
rdfs:label "MA"^^xsd:string ;
.
ex:MD
rdf:type ex:USState ;
rdfs:label "MD"^^xsd:string ;
.
ex:ME
rdf:type ex:USState ;
rdfs:label "ME"^^xsd:string ;
.
ex:MI
rdf:type ex:USState ;
rdfs:label "MI"^^xsd:string ;
.
ex:MN
rdf:type ex:USState ;
rdfs:label "MN"^^xsd:string ;
.
ex:MO
rdf:type ex:USState ;
rdfs:label "MO"^^xsd:string ;
.
ex:MS
rdf:type ex:USState ;
rdfs:label "MS"^^xsd:string ;
.
ex:MT
rdf:type ex:USState ;
rdfs:label "MT"^^xsd:string ;
.
ex:NC
rdf:type ex:USState ;
rdfs:label "NC"^^xsd:string ;
.
ex:ND
rdf:type ex:USState ;
rdfs:label "ND"^^xsd:string ;
.
ex:NE
rdf:type ex:USState ;
rdfs:label "NE"^^xsd:string ;
.
ex:NH
rdf:type ex:USState ;
rdfs:label "NH"^^xsd:string ;
.
ex:NJ
rdf:type ex:USState ;
rdfs:label "NJ"^^xsd:string ;
.
ex:NM
rdf:type ex:USState ;
rdfs:label "NM"^^xsd:string ;
.
ex:NSW
rdf:type ex:AustralianState ;
rdfs:label "NSW"^^xsd:string ;
.
ex:NT
rdf:type ex:AustralianState ;
rdfs:label "NT"^^xsd:string ;
.
ex:NV
rdf:type ex:USState ;
rdfs:label "NV"^^xsd:string ;
.
ex:NY
rdf:type ex:USState ;
rdfs:label "NY"^^xsd:string ;
.
ex:OH
rdf:type ex:USState ;
rdfs:label "OH"^^xsd:string ;
.
ex:OK
rdf:type ex:USState ;
rdfs:label "OK"^^xsd:string ;
.
ex:OR
rdf:type ex:USState ;
rdfs:label "OR"^^xsd:string ;
.
ex:PA
rdf:type ex:USState ;
rdfs:label "PA"^^xsd:string ;
.
ex:QLD
rdf:type ex:AustralianState ;
rdfs:label "QLD"^^xsd:string ;
.
ex:RI
rdf:type ex:USState ;
rdfs:label "RI"^^xsd:string ;
.
ex:SA
rdf:type ex:AustralianState ;
rdfs:label "SA"^^xsd:string ;
.
ex:SC
rdf:type ex:USState ;
rdfs:label "SC"^^xsd:string ;
.
ex:SD
rdf:type ex:USState ;
rdfs:label "SD"^^xsd:string ;
.
ex:State
rdf:type owl:Class ;
rdfs:label "State"^^xsd:string ;
rdfs:subClassOf owl:Thing ;
.
ex:TAS
rdf:type ex:AustralianState ;
rdfs:label "TAS"^^xsd:string ;
.
ex:TN
rdf:type ex:USState ;
rdfs:label "TN"^^xsd:string ;
.
ex:TX
rdf:type ex:USState ;
rdfs:label "TX"^^xsd:string ;
.
ex:USA
rdf:type ex:Country ;
ex:state ex:AK ;
ex:state ex:AL ;
ex:state ex:AR ;
ex:state ex:AZ ;
ex:state ex:CA ;
ex:state ex:CO ;
ex:state ex:CT ;
ex:state ex:DE ;
ex:state ex:FA ;
ex:state ex:FL ;
ex:state ex:HI ;
ex:state ex:IA ;
ex:state ex:ID ;
ex:state ex:IL ;
ex:state ex:IN ;
ex:state ex:KS ;
ex:state ex:KY ;
ex:state ex:LA ;
ex:state ex:MA ;
ex:state ex:MD ;
ex:state ex:ME ;
ex:state ex:MI ;
ex:state ex:MN ;
ex:state ex:MO ;
ex:state ex:MS ;
ex:state ex:MT ;
ex:state ex:NC ;
ex:state ex:ND ;
ex:state ex:NE ;
ex:state ex:NH ;
ex:state ex:NJ ;
ex:state ex:NM ;
ex:state ex:NV ;
ex:state ex:NY ;
ex:state ex:OH ;
ex:state ex:OK ;
ex:state ex:OR ;
ex:state ex:PA ;
ex:state ex:RI ;
ex:state ex:SC ;
ex:state ex:SD ;
ex:state ex:TN ;
ex:state ex:TX ;
ex:state ex:UT ;
ex:state ex:VA ;
ex:state ex:VT ;
ex:state ex:WA ;
ex:state ex:WI ;
ex:state ex:WV ;
ex:state ex:WY ;
rdfs:label "USA"^^xsd:string ;
.
ex:USState
rdf:type owl:Class ;
rdfs:label "US state"^^xsd:string ;
rdfs:subClassOf ex:State ;
.
ex:UT
rdf:type ex:USState ;
rdfs:label "UT"^^xsd:string ;
.
ex:VA
rdf:type ex:USState ;
rdfs:label "VA"^^xsd:string ;
.
ex:VIC
rdf:type ex:AustralianState ;
rdfs:label "VIC"^^xsd:string ;
.
ex:VT
rdf:type ex:USState ;
rdfs:label "VT"^^xsd:string ;
.
ex:WA
rdf:type ex:USState ;
rdfs:label "WA"^^xsd:string ;
.
ex:WI
rdf:type ex:USState ;
rdfs:label "WI"^^xsd:string ;
.
ex:WV
rdf:type ex:USState ;
rdfs:label "WV"^^xsd:string ;
.
ex:WY
rdf:type ex:USState ;
rdfs:label "WY"^^xsd:string ;
.
ex:addressCountry
rdf:type owl:FunctionalProperty ;
rdf:type owl:ObjectProperty ;
rdfs:domain ex:Address ;
rdfs:label "country"^^xsd:string ;
rdfs:range ex:Country ;
.
ex:addressPostalCode
rdf:type owl:DatatypeProperty ;
rdf:type owl:FunctionalProperty ;
rdfs:domain ex:Address ;
rdfs:label "postal code"^^xsd:string ;
rdfs:range xsd:string ;
.
ex:addressState
rdf:type owl:FunctionalProperty ;
rdf:type owl:ObjectProperty ;
spl:dynamicEnumRange [
rdf:type spl:ThisObjectsObjects ;
arg:firstProperty ex:addressCountry ;
arg:secondProperty ex:state ;
] ;
spl:dynamicEnumRangeTrigger ex:addressCountry ;
rdfs:domain ex:Address ;
rdfs:label "state"^^xsd:string ;
rdfs:range ex:State ;
.
ex:addressStreet
rdf:type owl:DatatypeProperty ;
rdf:type owl:FunctionalProperty ;
rdfs:domain ex:Address ;
rdfs:label "street"^^xsd:string ;
rdfs:range xsd:string ;
.
ex:state
rdf:type owl:ObjectProperty ;
rdfs:domain ex:Country ;
rdfs:label "state"^^xsd:string ;
rdfs:range ex:State ;
.