Holger Knublauch

Introduced metaclass for report types, simplified autocomplete code

...@@ -274,7 +274,7 @@ app:AbstractSubject ...@@ -274,7 +274,7 @@ app:AbstractSubject
274 app:AutoComplete 274 app:AutoComplete
275 rdf:type ui:NodeClass ; 275 rdf:type ui:NodeClass ;
276 rdfs:label "Auto complete"^^xsd:string ; 276 rdfs:label "Auto complete"^^xsd:string ;
277 - rdfs:subClassOf app:Elements ; 277 + rdfs:subClassOf app:AutoCompleteElements ;
278 spin:constraint 278 spin:constraint
279 [ rdf:type spl:Argument ; 279 [ rdf:type spl:Argument ;
280 rdfs:comment "The id of the HTML input element."^^xsd:string ; 280 rdfs:comment "The id of the HTML input element."^^xsd:string ;
...@@ -299,12 +299,6 @@ app:AutoComplete ...@@ -299,12 +299,6 @@ app:AutoComplete
299 arg:type 299 arg:type
300 [ sp:varName "type"^^xsd:string 300 [ sp:varName "type"^^xsd:string
301 ] ; 301 ] ;
302 - let:displayId
303 - [ rdf:type fn:concat ;
304 - sp:arg1 [ sp:varName "id"^^xsd:string
305 - ] ;
306 - sp:arg2 "-field"
307 - ] ;
308 ui:child 302 ui:child
309 [ rdf:type html:Input ; 303 [ rdf:type html:Input ;
310 html:id [ sp:varName "id"^^xsd:string 304 html:id [ sp:varName "id"^^xsd:string
...@@ -321,38 +315,207 @@ app:AutoComplete ...@@ -321,38 +315,207 @@ app:AutoComplete
321 ui:childIndex 0 315 ui:childIndex 0
322 ] ; 316 ] ;
323 ui:child 317 ui:child
324 - [ rdf:type html:Input ; 318 + [ rdf:type ui:group ;
325 - html:class "appAutoComplete"^^xsd:string ; 319 + let:displayId
326 - html:id [ sp:varName "displayId"^^xsd:string 320 + [ rdf:type ui:concat ;
327 - ] ; 321 + sp:arg1 [ sp:varName "id"^^xsd:string
328 - html:value 322 + ] ;
329 - [ rdf:type ui:label ; 323 + sp:arg2 "-field"^^xsd:string
330 - sp:arg1 [ sp:varName "initialValue"^^xsd:string
331 - ]
332 ] ; 324 ] ;
333 - ui:childIndex 1 325 + ui:child
334 - ] ; 326 + [ rdf:type html:Input ;
335 - ui:child 327 + html:class "appAutoComplete"^^xsd:string ;
336 - [ rdf:type app:WidgetInitializer ; 328 + html:id [ sp:varName "displayId"^^xsd:string
337 - arg:script
338 - [ rdf:type fn:concat ;
339 - sp:arg1 "appInitAutoComplete('" ;
340 - sp:arg2 [ sp:varName "displayId"^^xsd:string
341 ] ; 329 ] ;
342 - sp:arg3 "', '" ; 330 + html:value
343 - sp:arg4 [ sp:varName "id"^^xsd:string 331 + [ rdf:type ui:label ;
332 + sp:arg1 [ sp:varName "initialValue"^^xsd:string
333 + ]
344 ] ; 334 ] ;
345 - sp:arg5 "', '" ; 335 + ui:childIndex 0
346 - sp:arg6 [ sp:varName "link"^^xsd:string 336 + ] ;
337 + ui:child
338 + [ rdf:type app:WidgetInitializer ;
339 + arg:script
340 + [ rdf:type ui:concat ;
341 + sp:arg1 "appInitAutoComplete('"^^xsd:string ;
342 + sp:arg2 [ sp:varName "displayId"^^xsd:string
343 + ] ;
344 + sp:arg3 "', '"^^xsd:string ;
345 + sp:arg4 [ sp:varName "id"^^xsd:string
346 + ] ;
347 + sp:arg5 "', '"^^xsd:string ;
348 + sp:arg6 [ sp:varName "link"^^xsd:string
349 + ] ;
350 + sp:arg7 "')"^^xsd:string
347 ] ; 351 ] ;
348 - sp:arg7 "')" 352 + ui:childIndex 1
349 ] ; 353 ] ;
350 - ui:childIndex 2 354 + ui:childIndex 1
351 ] ; 355 ] ;
356 + ui:format "json"^^xsd:string ;
352 ui:sendQueryGraph "true"^^xsd:boolean ; 357 ui:sendQueryGraph "true"^^xsd:boolean ;
353 - ui:servlet "imports/autoCompleteCallback.json.swp"^^xsd:string 358 + ui:snippet "true"^^xsd:string ;
359 + ui:viewClass app:AutoCompleteCallback
354 ] . 360 ] .
355 361
362 +app:AutoCompleteCallback
363 + rdf:type ui:NodeClass ;
364 + rdfs:comment "Internally used by the AutoComplete widget to fetch the matching resources."^^xsd:string ;
365 + rdfs:label "Auto complete callback"^^xsd:string ;
366 + rdfs:subClassOf app:AutoCompleteElements ;
367 + spin:constraint
368 + [ rdf:type spl:Argument ;
369 + rdfs:comment "The start of the name as entered by the user."^^xsd:string ;
370 + spl:predicate arg:term ;
371 + spl:valueType xsd:string
372 + ] ;
373 + spin:constraint
374 + [ rdf:type spl:Argument ;
375 + rdfs:comment "The type of resource to get matching instances of."^^xsd:string ;
376 + spl:predicate arg:type ;
377 + spl:valueType rdfs:Class
378 + ] ;
379 + ui:private "true"^^xsd:boolean ;
380 + ui:prototype
381 + [ rdf:type ui:group ;
382 + ui:child
383 + [ rdf:type ui:TextNode ;
384 + ui:childIndex 0 ;
385 + ui:text """
386 + [
387 + """^^xsd:string
388 + ] ;
389 + ui:child
390 + [ rdf:type ui:forEach ;
391 + ui:child
392 + [ rdf:type ui:TextNode ;
393 + ui:childIndex 0 ;
394 + ui:text """{
395 + \"label\" : \""""^^xsd:string
396 + ] ;
397 + ui:child
398 + [ rdf:type ui:TextNode ;
399 + ui:childIndex 1 ;
400 + ui:text [ sp:varName "label"^^xsd:string
401 + ]
402 + ] ;
403 + ui:child
404 + [ rdf:type ui:TextNode ;
405 + ui:childIndex 2 ;
406 + ui:text """\",
407 + \"resource\" : \""""^^xsd:string
408 + ] ;
409 + ui:child
410 + [ rdf:type ui:TextNode ;
411 + ui:childIndex 3 ;
412 + ui:text [ rdf:type ui:encodeNode ;
413 + sp:arg1 [ sp:varName "resource"^^xsd:string
414 + ]
415 + ]
416 + ] ;
417 + ui:child
418 + [ rdf:type ui:TextNode ;
419 + ui:childIndex 4 ;
420 + ui:text """\",
421 + \"value\" : \""""^^xsd:string
422 + ] ;
423 + ui:child
424 + [ rdf:type ui:TextNode ;
425 + ui:childIndex 5 ;
426 + ui:text [ sp:varName "label"^^xsd:string
427 + ]
428 + ] ;
429 + ui:child
430 + [ rdf:type ui:TextNode ;
431 + ui:childIndex 6 ;
432 + ui:text """\"
433 + }"""^^xsd:string
434 + ] ;
435 + ui:childIndex 1 ;
436 + ui:resultSet
437 + [ rdf:type sp:Select ;
438 + sp:resultVariables ([ sp:varName "resource"^^xsd:string
439 + ] [ sp:varName "label"^^xsd:string
440 + ]) ;
441 + sp:where ([ sp:object
442 + [ sp:varName "type"^^xsd:string
443 + ] ;
444 + sp:predicate rdf:first ;
445 + sp:subject
446 + [ sp:varName "?0"^^xsd:string
447 + ]
448 + ] [ sp:object
449 + [ sp:varName "?1"^^xsd:string
450 + ] ;
451 + sp:predicate rdf:rest ;
452 + sp:subject
453 + [ sp:varName "?0"^^xsd:string
454 + ]
455 + ] [ sp:object
456 + [ sp:varName "term"^^xsd:string
457 + ] ;
458 + sp:predicate rdf:first ;
459 + sp:subject
460 + [ sp:varName "?1"^^xsd:string
461 + ]
462 + ] [ sp:object () ;
463 + sp:predicate rdf:rest ;
464 + sp:subject
465 + [ sp:varName "?1"^^xsd:string
466 + ]
467 + ] [ sp:object
468 + [ sp:varName "?2"^^xsd:string
469 + ] ;
470 + sp:predicate ui:autoComplete ;
471 + sp:subject
472 + [ sp:varName "?0"^^xsd:string
473 + ]
474 + ] [ sp:object
475 + [ sp:varName "resource"^^xsd:string
476 + ] ;
477 + sp:predicate rdf:first ;
478 + sp:subject
479 + [ sp:varName "?2"^^xsd:string
480 + ]
481 + ] [ sp:object
482 + [ sp:varName "?3"^^xsd:string
483 + ] ;
484 + sp:predicate rdf:rest ;
485 + sp:subject
486 + [ sp:varName "?2"^^xsd:string
487 + ]
488 + ] [ sp:object
489 + [ sp:varName "label"^^xsd:string
490 + ] ;
491 + sp:predicate rdf:first ;
492 + sp:subject
493 + [ sp:varName "?3"^^xsd:string
494 + ]
495 + ] [ sp:object () ;
496 + sp:predicate rdf:rest ;
497 + sp:subject
498 + [ sp:varName "?3"^^xsd:string
499 + ]
500 + ])
501 + ] ;
502 + ui:separator ","^^xsd:string
503 + ] ;
504 + ui:child
505 + [ rdf:type ui:TextNode ;
506 + ui:childIndex 2 ;
507 + ui:text """
508 + ]
509 +"""^^xsd:string
510 + ]
511 + ] .
512 +
513 +app:AutoCompleteElements
514 + rdf:type ui:NodeClass ;
515 + rdfs:label "Auto complete elements"^^xsd:string ;
516 + rdfs:subClassOf app:Elements ;
517 + ui:abstract "true"^^xsd:boolean .
518 +
356 app:BNodeViewer 519 app:BNodeViewer
357 rdf:type app:ObjectViewerClass ; 520 rdf:type app:ObjectViewerClass ;
358 rdfs:label "BNode viewer"^^xsd:string ; 521 rdfs:label "BNode viewer"^^xsd:string ;
...@@ -7502,6 +7665,11 @@ arg:targetId ...@@ -7502,6 +7665,11 @@ arg:targetId
7502 rdfs:label "target id"^^xsd:string ; 7665 rdfs:label "target id"^^xsd:string ;
7503 rdfs:subPropertyOf sp:arg . 7666 rdfs:subPropertyOf sp:arg .
7504 7667
7668 +arg:term
7669 + rdf:type rdf:Property ;
7670 + rdfs:label "term"^^xsd:string ;
7671 + rdfs:subPropertyOf sp:arg .
7672 +
7505 arg:toggleFunctionCall 7673 arg:toggleFunctionCall
7506 rdf:type rdf:Property ; 7674 rdf:type rdf:Property ;
7507 rdfs:label "toggle function call"^^xsd:string ; 7675 rdfs:label "toggle function call"^^xsd:string ;
......
1 -<ui:group
2 - let:type="{= ui:param('type', rdfs:Class) }"
3 - let:prefix="{= ui:param('term') }">
4 - [
5 - <ui:forEach ui:resultSet="{#
6 - SELECT ?resource ?label
7 - WHERE {
8 - (?type ?prefix) ui:autoComplete (?resource ?label) .
9 - }
10 - }" ui:indexVar="index">
11 - <ui:if ui:condition="{= ?index &gt; 0 }">,</ui:if>
12 - {
13 - "label" : "{= ?label }",
14 - "resource" : "{= ui:encodeNode(?resource) }",
15 - "value" : "{= ?label }"
16 - }
17 - </ui:forEach>
18 - ]
19 -</ui:group>
...\ No newline at end of file ...\ No newline at end of file
...@@ -140,7 +140,7 @@ log:reportType ...@@ -140,7 +140,7 @@ log:reportType
140 rdf:type owl:ObjectProperty ; 140 rdf:type owl:ObjectProperty ;
141 rdfs:domain log:ReportEvent ; 141 rdfs:domain log:ReportEvent ;
142 rdfs:label "report type"^^xsd:string ; 142 rdfs:label "report type"^^xsd:string ;
143 - rdfs:range rdfs:Class . 143 + rdfs:range <http://www.reportinghub.no/system/schema/reporting#ReportClass> .
144 144
145 log:url 145 log:url
146 rdf:type owl:DatatypeProperty ; 146 rdf:type owl:DatatypeProperty ;
......
...@@ -21,7 +21,7 @@ sioc:id ...@@ -21,7 +21,7 @@ sioc:id
21 owl:versionInfo "0.2.0"^^xsd:string . 21 owl:versionInfo "0.2.0"^^xsd:string .
22 22
23 report:AbstractDR 23 report:AbstractDR
24 - rdf:type owl:Class ; 24 + rdf:type report:ReportClass ;
25 rdfs:comment "Abstract base class for various types of daily reports."^^xsd:string ; 25 rdfs:comment "Abstract base class for various types of daily reports."^^xsd:string ;
26 rdfs:label "Daily report"^^xsd:string ; 26 rdfs:label "Daily report"^^xsd:string ;
27 rdfs:subClassOf foaf:Document ; 27 rdfs:subClassOf foaf:Document ;
...@@ -57,12 +57,12 @@ report:AbstractDR ...@@ -57,12 +57,12 @@ report:AbstractDR
57 ] . 57 ] .
58 58
59 report:AbstractMPR 59 report:AbstractMPR
60 - rdf:type owl:Class ; 60 + rdf:type report:ReportClass ;
61 rdfs:label "Abstract MPR"^^xsd:string ; 61 rdfs:label "Abstract MPR"^^xsd:string ;
62 rdfs:subClassOf foaf:Document . 62 rdfs:subClassOf foaf:Document .
63 63
64 report:DDR 64 report:DDR
65 - rdf:type owl:Class ; 65 + rdf:type report:ReportClass ;
66 rdfs:comment "The metadata about a Daily Drilling Report."^^xsd:string ; 66 rdfs:comment "The metadata about a Daily Drilling Report."^^xsd:string ;
67 rdfs:label "DDR"^^xsd:string ; 67 rdfs:label "DDR"^^xsd:string ;
68 rdfs:subClassOf report:AbstractDR ; 68 rdfs:subClassOf report:AbstractDR ;
...@@ -78,7 +78,7 @@ report:DDR ...@@ -78,7 +78,7 @@ report:DDR
78 ] . 78 ] .
79 79
80 report:DPR 80 report:DPR
81 - rdf:type owl:Class ; 81 + rdf:type report:ReportClass ;
82 rdfs:comment "The metadata about a Daily Production Report."^^xsd:string ; 82 rdfs:comment "The metadata about a Daily Production Report."^^xsd:string ;
83 rdfs:label "DPR"^^xsd:string ; 83 rdfs:label "DPR"^^xsd:string ;
84 rdfs:subClassOf report:AbstractDR ; 84 rdfs:subClassOf report:AbstractDR ;
...@@ -98,22 +98,22 @@ report:HTMLFormat ...@@ -98,22 +98,22 @@ report:HTMLFormat
98 rdfs:label "HTMLFormat"^^xsd:string . 98 rdfs:label "HTMLFormat"^^xsd:string .
99 99
100 report:MPRD 100 report:MPRD
101 - rdf:type owl:Class ; 101 + rdf:type report:ReportClass ;
102 rdfs:label "MPRD"^^xsd:string ; 102 rdfs:label "MPRD"^^xsd:string ;
103 rdfs:subClassOf report:AbstractMPR . 103 rdfs:subClassOf report:AbstractMPR .
104 104
105 report:MPRG 105 report:MPRG
106 - rdf:type owl:Class ; 106 + rdf:type report:ReportClass ;
107 rdfs:label "MPRG"^^xsd:string ; 107 rdfs:label "MPRG"^^xsd:string ;
108 rdfs:subClassOf report:AbstractMPR . 108 rdfs:subClassOf report:AbstractMPR .
109 109
110 report:MPRP 110 report:MPRP
111 - rdf:type owl:Class ; 111 + rdf:type report:ReportClass ;
112 rdfs:label "MPRP"^^xsd:string ; 112 rdfs:label "MPRP"^^xsd:string ;
113 rdfs:subClassOf report:AbstractMPR . 113 rdfs:subClassOf report:AbstractMPR .
114 114
115 report:NPTR 115 report:NPTR
116 - rdf:type owl:Class ; 116 + rdf:type report:ReportClass ;
117 rdfs:comment "Metadata about a Non-Productive Time Report."^^xsd:string ; 117 rdfs:comment "Metadata about a Non-Productive Time Report."^^xsd:string ;
118 rdfs:label "NPTR"^^xsd:string ; 118 rdfs:label "NPTR"^^xsd:string ;
119 rdfs:subClassOf foaf:Document . 119 rdfs:subClassOf foaf:Document .
...@@ -122,8 +122,14 @@ report:PDFFormat ...@@ -122,8 +122,14 @@ report:PDFFormat
122 rdf:type report:Format ; 122 rdf:type report:Format ;
123 rdfs:label "PDFFormat"^^xsd:string . 123 rdfs:label "PDFFormat"^^xsd:string .
124 124
125 +report:ReportClass
126 + rdf:type rdfs:Class ;
127 + rdfs:comment "Metaclass for the various report types."^^xsd:string ;
128 + rdfs:label "Report class"^^xsd:string ;
129 + rdfs:subClassOf owl:Class .
130 +
125 report:WDR 131 report:WDR
126 - rdf:type owl:Class ; 132 + rdf:type report:ReportClass ;
127 rdfs:comment "Metadata about a Weekly Drilling Report"^^xsd:string ; 133 rdfs:comment "Metadata about a Weekly Drilling Report"^^xsd:string ;
128 rdfs:label "WDR"^^xsd:string ; 134 rdfs:label "WDR"^^xsd:string ;
129 rdfs:subClassOf foaf:Document . 135 rdfs:subClassOf foaf:Document .
......