Holger Knublauch

Added missing swon file (will be in 3.6.0 beta as well)

# baseURI: http://uispin.org/swon
# imports: http://uispin.org/ui
@prefix arg: <http://spinrdf.org/arg#> .
@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 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 swon: <http://uispin.org/swon#> .
@prefix ui: <http://uispin.org/ui#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
arg:labelFunction
rdf:type rdf:Property ;
rdfs:label "label function"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:name
rdf:type rdf:Property ;
rdfs:label "name"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:resultSet
rdf:type rdf:Property ;
rdfs:label "result set"^^xsd:string ;
rdfs:subPropertyOf ui:resultSet .
arg:rowIndex
rdf:type rdf:Property ;
rdfs:label "row index"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:value
rdf:type rdf:Property ;
rdfs:label "value"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
<http://uispin.org/swon>
rdf:type owl:Ontology ;
rdfs:comment "A library of SWP elements for creating JSON text output."^^xsd:string ;
owl:imports <http://uispin.org/ui> ;
owl:versionInfo "0.1.0"^^xsd:string .
swon:Elements
rdf:type ui:NodeClass ;
rdfs:comment "Abstract superclass of the JSON elements."^^xsd:string ;
rdfs:label "JSON Elements"^^xsd:string ;
rdfs:subClassOf ui:Element ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "An option function that can be used to transform the values before they are inserted into the name-value pairs. A typical use case is to use ui:label."^^xsd:string ;
spl:optional "true"^^xsd:boolean ;
spl:predicate arg:labelFunction ;
spl:valueType spin:Function
] ;
ui:abstract "true"^^xsd:boolean .
swon:ForEachResultSetColumnIndex
rdf:type spin:SelectTemplate ;
rdfs:label "For each result set column index"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ sp:varName "colIndex"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "colIndex"^^xsd:string
] ;
sp:predicate spr:colIndices ;
sp:subject
[ sp:varName "resultSet"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The result set to get all column indices of."^^xsd:string ;
spl:predicate arg:resultSet ;
spl:valueType sp:Select
] .
swon:ForEachResultSetRowIndex
rdf:type spin:SelectTemplate ;
rdfs:label "For each result set row index"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ sp:varName "rowIndex"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "rowIndex"^^xsd:string
] ;
sp:predicate spr:rowIndices ;
sp:subject
[ sp:varName "resultSet"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The result set to get all column indices of."^^xsd:string ;
spl:predicate arg:resultSet ;
spl:valueType sp:Select
] .
swon:NameValuePair
rdf:type ui:NodeClass ;
rdfs:label "Name value pair"^^xsd:string ;
rdfs:subClassOf swon:Elements ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The name of the variable."^^xsd:string ;
spl:predicate arg:name ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The value (will be rendered as null if unbound)."^^xsd:string ;
spl:optional "true"^^xsd:boolean ;
spl:predicate arg:value
] ;
ui:prototype
[ rdf:type ui:group ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 0 ;
ui:text "\""^^xsd:string
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 1 ;
ui:text [ sp:varName "name"^^xsd:string
]
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 2 ;
ui:text "\":"^^xsd:string
] ;
ui:child
[ rdf:type ui:if ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 0 ;
ui:text "\""^^xsd:string
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 1 ;
ui:text [ rdf:type ui:escapeJSON ;
sp:arg1 [ rdf:type sp:if ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 [ sp:varName "labelFunction"^^xsd:string
]
] ;
sp:arg2 [ rdf:type spif:invoke ;
sp:arg1 [ sp:varName "labelFunction"^^xsd:string
] ;
sp:arg2 [ sp:varName "value"^^xsd:string
]
] ;
sp:arg3 [ rdf:type xsd:string ;
sp:arg1 [ sp:varName "value"^^xsd:string
]
]
]
]
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 2 ;
ui:text "\""^^xsd:string
] ;
ui:childIndex 3 ;
ui:condition
[ rdf:type sp:bound ;
sp:arg1 [ sp:varName "value"^^xsd:string
]
]
] ;
ui:child
[ rdf:type ui:else ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 0 ;
ui:text "null"^^xsd:string
] ;
ui:childIndex 4
]
] .
swon:RSArray
rdf:type ui:NodeClass ;
rdfs:comment "Creates a simple JSON array with all values from the first column of a given result set, e.g. ['A','B','C']."^^xsd:string ;
rdfs:label "RS Array"^^xsd:string ;
rdfs:subClassOf swon:Elements ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The result set to walk through."^^xsd:string ;
spl:predicate arg:resultSet ;
spl:valueType sp:Select
] ;
ui:prototype
[ rdf:type ui:call ;
arg:resultSet
[ sp:varName "resultSet"^^xsd:string
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 0 ;
ui:text "["^^xsd:string
] ;
ui:child
[ rdf:type ui:forEach ;
ui:child
[ rdf:type ui:group ;
let:value
[ rdf:type spr:cell ;
sp:arg1 [ sp:varName "resultSet"^^xsd:string
] ;
sp:arg2 [ sp:varName "rowIndex"^^xsd:string
] ;
sp:arg3 0
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 0 ;
ui:text "\""^^xsd:string
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 1 ;
ui:text [ rdf:type ui:escapeJSON ;
sp:arg1 [ rdf:type sp:if ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 [ sp:varName "labelFunction"^^xsd:string
]
] ;
sp:arg2 [ rdf:type spif:invoke ;
sp:arg1 [ sp:varName "labelFunction"^^xsd:string
] ;
sp:arg2 [ sp:varName "value"^^xsd:string
]
] ;
sp:arg3 [ rdf:type xsd:string ;
sp:arg1 [ sp:varName "value"^^xsd:string
]
]
]
]
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 2 ;
ui:text "\""^^xsd:string
] ;
ui:childIndex 0
] ;
ui:childIndex 1 ;
ui:resultSet
[ sp:varName "rs"^^xsd:string
] ;
ui:separator ","^^xsd:string
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 2 ;
ui:text "]"^^xsd:string
] ;
ui:template swon:ForEachResultSetRowIndex
] .
swon:RSObject
rdf:type ui:NodeClass ;
rdfs:label "RS object"^^xsd:string ;
rdfs:subClassOf swon:Elements ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The result set containing the name-value pairs - the names are the result variables. If the optional row index isn't present, the system will use the first row."^^xsd:string ;
spl:predicate arg:resultSet ;
spl:valueType sp:Select
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The (optional) row index to select the object."^^xsd:string ;
spl:optional "true"^^xsd:boolean ;
spl:predicate arg:rowIndex ;
spl:valueType xsd:integer
] ;
ui:prototype
[ rdf:type ui:call ;
arg:resultSet
[ sp:varName "resultSet"^^xsd:string
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 0 ;
ui:text "{"^^xsd:string
] ;
ui:child
[ rdf:type ui:forEach ;
ui:child
[ rdf:type swon:NameValuePair ;
arg:labelFunction
[ sp:varName "labelFunction"^^xsd:string
] ;
arg:name
[ rdf:type spr:colName ;
sp:arg1 [ sp:varName "resultSet"^^xsd:string
] ;
sp:arg2 [ sp:varName "colIndex"^^xsd:string
]
] ;
arg:value
[ rdf:type spr:cell ;
sp:arg1 [ sp:varName "resultSet"^^xsd:string
] ;
sp:arg2 [ rdf:type sp:coalesce ;
sp:arg1 [ sp:varName "rowIndex"^^xsd:string
] ;
sp:arg2 0
] ;
sp:arg3 [ sp:varName "colIndex"^^xsd:string
]
] ;
ui:childIndex 0
] ;
ui:childIndex 1 ;
ui:resultSet
[ sp:varName "rs"^^xsd:string
] ;
ui:separator ","^^xsd:string
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 2 ;
ui:text "}"^^xsd:string
] ;
ui:template swon:ForEachResultSetColumnIndex
] .
swon:RSObjectArray
rdf:type ui:NodeClass ;
rdfs:comment "Creates a JSON array from a result set where each item is a swon:RSObject, with fields for each variable."^^xsd:string ;
rdfs:label "RS object array"^^xsd:string ;
rdfs:subClassOf swon:Elements ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The result set delivering the rows."^^xsd:string ;
spl:predicate arg:resultSet ;
spl:valueType sp:Select
] ;
ui:prototype
[ rdf:type ui:call ;
arg:resultSet
[ sp:varName "resultSet"^^xsd:string
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 0 ;
ui:text "["^^xsd:string
] ;
ui:child
[ rdf:type ui:forEach ;
ui:child
[ rdf:type swon:RSObject ;
arg:labelFunction
[ sp:varName "labelFunction"^^xsd:string
] ;
arg:resultSet
[ sp:varName "resultSet"^^xsd:string
] ;
arg:rowIndex
[ sp:varName "rowIndex"^^xsd:string
] ;
ui:childIndex 0
] ;
ui:childIndex 1 ;
ui:resultSet
[ sp:varName "rs"^^xsd:string
] ;
ui:separator ","^^xsd:string
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 2 ;
ui:text "]"^^xsd:string
] ;
ui:template swon:ForEachResultSetRowIndex
] .