namespaced entities
This commit is contained in:
		
							parent
							
								
									dde1fa6e82
								
							
						
					
					
						commit
						50f8daa2f3
					
				
					 19 changed files with 98 additions and 96 deletions
				
			
		| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
<entity name="entity" xmlns="https://github.com/Quodatum/app-doc/entity">
 | 
					<entity name="dice.entity" xmlns="https://github.com/Quodatum/app-doc/entity">
 | 
				
			||||||
	<description>List of Entities i.e. things described in this framework
 | 
						<description>List of Entities i.e. things described in this framework
 | 
				
			||||||
	</description>
 | 
						</description>
 | 
				
			||||||
	<namespace prefix="ent"
 | 
						<namespace prefix="ent"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
<entity name="entity.field" xmlns="https://github.com/Quodatum/app-doc/entity">
 | 
					<entity name="dice.field" xmlns="https://github.com/Quodatum/app-doc/entity">
 | 
				
			||||||
	<description>About an entity field. </description>
 | 
						<description>About an entity field. </description>
 | 
				
			||||||
	<namespace prefix="ent"
 | 
						<namespace prefix="ent"
 | 
				
			||||||
		uri="https://github.com/Quodatum/app-doc/entity" />
 | 
							uri="https://github.com/Quodatum/app-doc/entity" />
 | 
				
			||||||
| 
						 | 
					@ -71,7 +71,7 @@
 | 
				
			||||||
         var data={message: this.message,
 | 
					         var data={message: this.message,
 | 
				
			||||||
               type: this.type,
 | 
					               type: this.type,
 | 
				
			||||||
               checkbox: this.checkbox};
 | 
					               checkbox: this.checkbox};
 | 
				
			||||||
         HTTP.post("log/add",Qs.stringify(data))
 | 
					         HTTP.post("basex.log/add",Qs.stringify(data))
 | 
				
			||||||
      .then(r=>{
 | 
					      .then(r=>{
 | 
				
			||||||
        console.log("submit: ",data);
 | 
					        console.log("submit: ",data);
 | 
				
			||||||
        if(this.checkbox){
 | 
					        if(this.checkbox){
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,6 +63,7 @@
 | 
				
			||||||
      :search="search"
 | 
					      :search="search"
 | 
				
			||||||
      class="elevation-1"
 | 
					      class="elevation-1"
 | 
				
			||||||
      no-data-text="No logs found"
 | 
					      no-data-text="No logs found"
 | 
				
			||||||
 | 
					      sort-by= "time"
 | 
				
			||||||
      v-bind:options.sync="pagination"
 | 
					      v-bind:options.sync="pagination"
 | 
				
			||||||
    >
 | 
					    >
 | 
				
			||||||
    <template slot="items" slot-scope="props">
 | 
					    <template slot="items" slot-scope="props">
 | 
				
			||||||
| 
						 | 
					@ -95,7 +96,7 @@
 | 
				
			||||||
        { text: 'address', value: 'address' },
 | 
					        { text: 'address', value: 'address' },
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      items:[],
 | 
					      items:[],
 | 
				
			||||||
      pagination:{sortBy: 'time',descending:true,rowsPerPage:25},
 | 
					      pagination:{ rowsPerPage:25},
 | 
				
			||||||
      selected:[],
 | 
					      selected:[],
 | 
				
			||||||
      search:"",
 | 
					      search:"",
 | 
				
			||||||
      loading:false,
 | 
					      loading:false,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,12 +7,12 @@ import module namespace web = 'quodatum.web.utils4' at "../../lib/webutils.xqm";
 | 
				
			||||||
 :  show active log
 | 
					 :  show active log
 | 
				
			||||||
 :)
 | 
					 :)
 | 
				
			||||||
declare  
 | 
					declare  
 | 
				
			||||||
%rest:GET %rest:path("/vue-poc/api/log")
 | 
					%rest:GET %rest:path("/vue-poc/api/basex.log")
 | 
				
			||||||
%output:method("json")   
 | 
					%output:method("json")   
 | 
				
			||||||
function j:list()
 | 
					function j:list()
 | 
				
			||||||
as element(json)
 | 
					as element(json)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  let $entity:=$entity:list("basexlog")
 | 
					  let $entity:=$entity:list("basex.log")
 | 
				
			||||||
 let $items:=$entity("data")()
 | 
					 let $items:=$entity("data")()
 | 
				
			||||||
 let $items:=$items[false() or not(ends-with(. ,"/vue-poc/api/log"))]
 | 
					 let $items:=$items[false() or not(ends-with(. ,"/vue-poc/api/log"))]
 | 
				
			||||||
 (: let $_:=admin:write-log("hello admin:write-log") :)
 | 
					 (: let $_:=admin:write-log("hello admin:write-log") :)
 | 
				
			||||||
| 
						 | 
					@ -44,7 +44,7 @@ as element(json)
 | 
				
			||||||
 : create a log entry
 | 
					 : create a log entry
 | 
				
			||||||
 :)
 | 
					 :)
 | 
				
			||||||
declare  
 | 
					declare  
 | 
				
			||||||
%rest:POST %rest:path("/vue-poc/api/log/add")
 | 
					%rest:POST %rest:path("/vue-poc/api/basex.log/add")
 | 
				
			||||||
%rest:form-param("type", "{$type}")
 | 
					%rest:form-param("type", "{$type}")
 | 
				
			||||||
%rest:form-param("message", "{$message}")
 | 
					%rest:form-param("message", "{$message}")
 | 
				
			||||||
%output:method("text")   
 | 
					%output:method("text")   
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,7 @@
 | 
				
			||||||
			  :loading="loading"
 | 
								  :loading="loading"
 | 
				
			||||||
		      :disabled="loading"
 | 
							      :disabled="loading"
 | 
				
			||||||
			 ><v-icon>refresh</v-icon></v-btn>
 | 
								 ><v-icon>refresh</v-icon></v-btn>
 | 
				
			||||||
		   <vp-entitylink entity="entity"></vp-entitylink>
 | 
							   <vp-entitylink entity="dice.entity"></vp-entitylink>
 | 
				
			||||||
	 </v-toolbar>
 | 
						 </v-toolbar>
 | 
				
			||||||
	 </template>
 | 
						 </template>
 | 
				
			||||||
	 
 | 
						 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,7 +78,7 @@
 | 
				
			||||||
	          </v-layout>
 | 
						          </v-layout>
 | 
				
			||||||
	      </v-expansion-panel-header> 
 | 
						      </v-expansion-panel-header> 
 | 
				
			||||||
	      <v-expansion-panel-content>
 | 
						      <v-expansion-panel-content>
 | 
				
			||||||
	           <qd-table :headers="headers" :data-uri='"data/entity/"+entity +"/field"' entity="entity.field" no-data-msg="Nothing found">
 | 
						           <qd-table :headers="headers" :data-uri='"data/entity/"+entity +"/field"' entity="dice.field" no-data-msg="Nothing found">
 | 
				
			||||||
	          </qd-table>
 | 
						          </qd-table>
 | 
				
			||||||
	      </v-expansion-panel-content>
 | 
						      </v-expansion-panel-content>
 | 
				
			||||||
	     </v-expansion-panel>
 | 
						     </v-expansion-panel>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,7 +24,7 @@ declare
 | 
				
			||||||
%rest:query-param("q", "{$q}") 
 | 
					%rest:query-param("q", "{$q}") 
 | 
				
			||||||
%output:method("json")    
 | 
					%output:method("json")    
 | 
				
			||||||
function model-list($q) {
 | 
					function model-list($q) {
 | 
				
			||||||
 let $entity:=$entity:list("entity")
 | 
					 let $entity:=$entity:list("dice.entity")
 | 
				
			||||||
 let $items:=$entity?data()
 | 
					 let $items:=$entity?data()
 | 
				
			||||||
 let $items:=if($q)then $items[fn:contains($entity("access")("name")(.),$q)] else $items
 | 
					 let $items:=if($q)then $items[fn:contains($entity("access")("name")(.),$q)] else $items
 | 
				
			||||||
 return dice:response($items,$entity,web:dice())
 | 
					 return dice:response($items,$entity,web:dice())
 | 
				
			||||||
| 
						 | 
					@ -55,7 +55,7 @@ declare
 | 
				
			||||||
%rest:produces("application/json")
 | 
					%rest:produces("application/json")
 | 
				
			||||||
%output:method("json")    
 | 
					%output:method("json")    
 | 
				
			||||||
function model($entity) {
 | 
					function model($entity) {
 | 
				
			||||||
let $this:=$entity:list("entity")
 | 
					let $this:=$entity:list("dice.entity")
 | 
				
			||||||
 let $items:=$this?data()
 | 
					 let $items:=$this?data()
 | 
				
			||||||
 let $fields:=$this?json
 | 
					 let $fields:=$this?json
 | 
				
			||||||
 let $item:=$items[@name=$entity]
 | 
					 let $item:=$items[@name=$entity]
 | 
				
			||||||
| 
						 | 
					@ -72,7 +72,7 @@ declare
 | 
				
			||||||
%rest:produces("text/xml;qs=0.8")
 | 
					%rest:produces("text/xml;qs=0.8")
 | 
				
			||||||
%output:method("xml")    
 | 
					%output:method("xml")    
 | 
				
			||||||
function model2($entity) {
 | 
					function model2($entity) {
 | 
				
			||||||
let $this:=$entity:list("entity")
 | 
					let $this:=$entity:list("dice.entity")
 | 
				
			||||||
 let $items:=$this?data()
 | 
					 let $items:=$this?data()
 | 
				
			||||||
 let $fields:=$this?json
 | 
					 let $fields:=$this?json
 | 
				
			||||||
 let $item:=$items[@name=$entity]
 | 
					 let $item:=$items[@name=$entity]
 | 
				
			||||||
| 
						 | 
					@ -88,10 +88,10 @@ declare
 | 
				
			||||||
%rest:GET %rest:path("vue-poc/api/data/entity/{$entity}/field")
 | 
					%rest:GET %rest:path("vue-poc/api/data/entity/{$entity}/field")
 | 
				
			||||||
%output:method("json")    
 | 
					%output:method("json")    
 | 
				
			||||||
function field-list($entity) {
 | 
					function field-list($entity) {
 | 
				
			||||||
    let $dentity:=$entity:list("entity")
 | 
					    let $dentity:=$entity:list("dice.entity")
 | 
				
			||||||
    let $items:=$dentity?data()
 | 
					    let $items:=$dentity?data()
 | 
				
			||||||
    let $items:=$items[@name=$entity]/ent:fields/ent:field
 | 
					    let $items:=$items[@name=$entity]/ent:fields/ent:field
 | 
				
			||||||
    let $fentity:=$entity:list("entity.field")
 | 
					    let $fentity:=$entity:list("dice.field")
 | 
				
			||||||
    return dice:response($items,$fentity,web:dice())
 | 
					    return dice:response($items,$fentity,web:dice())
 | 
				
			||||||
                      
 | 
					                      
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -2,14 +2,13 @@
 | 
				
			||||||
 : generate xquery access code for entity definitions
 | 
					 : generate xquery access code for entity definitions
 | 
				
			||||||
 :)
 | 
					 :)
 | 
				
			||||||
module namespace bf = 'quodatum.tools.buildfields';
 | 
					module namespace bf = 'quodatum.tools.buildfields';
 | 
				
			||||||
declare default function namespace 'quodatum.tools.buildfields'; 
 | 
					 | 
				
			||||||
declare namespace ent="https://github.com/Quodatum/app-doc/entity"; 
 | 
					declare namespace ent="https://github.com/Quodatum/app-doc/entity"; 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(:~
 | 
					(:~
 | 
				
			||||||
 : generate xquery module for given entities as a string
 | 
					 : generate xquery module for given entities as a string
 | 
				
			||||||
 :)
 | 
					 :)
 | 
				
			||||||
declare function module($entities as element(ent:entity)*,$imports)
 | 
					declare function bf:module($entities as element(ent:entity)*,$imports)
 | 
				
			||||||
as xs:string
 | 
					as xs:string
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
let $src:= <text>(: entity access maps 
 | 
					let $src:= <text>(: entity access maps 
 | 
				
			||||||
| 
						 | 
					@ -36,14 +35,14 @@ as map(*){{
 | 
				
			||||||
(:~
 | 
					(:~
 | 
				
			||||||
 : generate xquery for to return field value in the format: "name":function($_){}
 | 
					 : generate xquery for to return field value in the format: "name":function($_){}
 | 
				
			||||||
 :)
 | 
					 :)
 | 
				
			||||||
declare function accessfn($f as element(ent:field)) as xs:string
 | 
					declare function bf:accessfn($f as element(ent:field)) as xs:string
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
let $type:=$f/@type/fn:string()
 | 
					let $type:=$f/@type/fn:string()
 | 
				
			||||||
return <field>
 | 
					return <field>
 | 
				
			||||||
       "{$f/@name/fn:string()}": function($_ as element()) as {$type} {{$_/{$f/ent:xpath } }}</field>
 | 
					       "{$f/@name/fn:string()}": function($_ as element()) as {$type} {{$_/{$f/ent:xpath } }}</field>
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
declare function generate($e as element(ent:entity)) as xs:string
 | 
					declare function bf:generate($e as element(ent:entity)) as xs:string
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  let $fields:=for $field in $e/ent:fields/ent:field   
 | 
					  let $fields:=for $field in $e/ent:fields/ent:field   
 | 
				
			||||||
                order by $field/@name
 | 
					                order by $field/@name
 | 
				
			||||||
| 
						 | 
					@ -55,14 +54,14 @@ declare function generate($e as element(ent:entity)) as xs:string
 | 
				
			||||||
  return <field>
 | 
					  return <field>
 | 
				
			||||||
  "{$e/@name/fn:string()}": map{{
 | 
					  "{$e/@name/fn:string()}": map{{
 | 
				
			||||||
     "name": "{ $e/@name/fn:string()}",
 | 
					     "name": "{ $e/@name/fn:string()}",
 | 
				
			||||||
     "description": "{ escape($e/ent:description)}",
 | 
					     "description": "{ bf:escape($e/ent:description)}",
 | 
				
			||||||
     "access": map{{ {$fields!accessfn(.)=>fn:string-join(",")} }},
 | 
					     "access": map{{ {$fields!bf:accessfn(.)=>fn:string-join(",")} }},
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
     "filter": function($item,$q) as xs:boolean{{ 
 | 
					     "filter": function($item,$q) as xs:boolean{{ 
 | 
				
			||||||
         some $e in ( {fn:string-join($filter,", ")}) satisfies
 | 
					         some $e in ( {fn:string-join($filter,", ")}) satisfies
 | 
				
			||||||
         fn:contains($e,$q, 'http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive')
 | 
					         fn:contains($e,$q, 'http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive')
 | 
				
			||||||
      }},
 | 
					      }},
 | 
				
			||||||
       "json":   map{{ {$fields!jsonfn(.)=>fn:string-join(",")} }},
 | 
					       "json":   map{{ {$fields!bf:jsonfn(.)=>fn:string-join(",")} }},
 | 
				
			||||||
       
 | 
					       
 | 
				
			||||||
      "data": function() as {$e/ent:data/@type/fn:string(.)}*
 | 
					      "data": function() as {$e/ent:data/@type/fn:string(.)}*
 | 
				
			||||||
       {{ {let $a:=$e/ent:data/fn:string() return if($a)then $a else "()"} }},
 | 
					       {{ {let $a:=$e/ent:data/fn:string() return if($a)then $a else "()"} }},
 | 
				
			||||||
| 
						 | 
					@ -76,23 +75,24 @@ declare function generate($e as element(ent:entity)) as xs:string
 | 
				
			||||||
(:~
 | 
					(:~
 | 
				
			||||||
 : @return sequence of element(entity) items for definitions at path
 | 
					 : @return sequence of element(entity) items for definitions at path
 | 
				
			||||||
 :)
 | 
					 :)
 | 
				
			||||||
declare function entities($path as xs:string) 
 | 
					declare function bf:entities($path as xs:string) 
 | 
				
			||||||
as element(ent:entity)*
 | 
					as element(ent:entity)*
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
let $_:=fn:trace($path,"DD")
 | 
					let $_:=fn:trace($path,"DD")
 | 
				
			||||||
 let $p:=fn:resolve-uri($path) || "/"
 | 
					 let $p:=fn:resolve-uri($path) || "/"
 | 
				
			||||||
 return for $f in file:list($p)
 | 
					 return for $f in file:list($p,fn:true())
 | 
				
			||||||
 | 
					        where not(ends-with(trace($f),file:dir-separator()))
 | 
				
			||||||
        order by $f
 | 
					        order by $f
 | 
				
			||||||
        return fn:doc(fn:concat($p,$f))/ent:entity
 | 
					        return fn:doc(fn:concat($p,$f))/ent:entity
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(:map for entity :)
 | 
					(:map for entity :)
 | 
				
			||||||
declare function build-map($entity as element(ent:entity)) 
 | 
					declare function bf:build-map($entity as element(ent:entity)) 
 | 
				
			||||||
as xs:string
 | 
					as xs:string
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
let $m:=for $field in $entity/ent:fields/ent:field   
 | 
					let $m:=for $field in $entity/ent:fields/ent:field   
 | 
				
			||||||
        order by $field/@name
 | 
					        order by $field/@name
 | 
				
			||||||
        return accessfn($field)
 | 
					        return bf:accessfn($field)
 | 
				
			||||||
return <text>
 | 
					return <text>
 | 
				
			||||||
declare variable $entity:{$entity/@name/fn:string()}: map{{ {fn:string-join($m,",")}
 | 
					declare variable $entity:{$entity/@name/fn:string()}: map{{ {fn:string-join($m,",")}
 | 
				
			||||||
}};
 | 
					}};
 | 
				
			||||||
| 
						 | 
					@ -103,14 +103,14 @@ declare variable $entity:{$entity/@name/fn:string()}: map{{ {fn:string-join($m,"
 | 
				
			||||||
(:~ 
 | 
					(:~ 
 | 
				
			||||||
 :  return xml for suitable json serialization for field 
 | 
					 :  return xml for suitable json serialization for field 
 | 
				
			||||||
:)
 | 
					:)
 | 
				
			||||||
declare function jsonfn($f as element(ent:field)) 
 | 
					declare function bf:jsonfn($f as element(ent:field)) 
 | 
				
			||||||
as xs:string
 | 
					as xs:string
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    let $name:=$f/@name/fn:string()
 | 
					    let $name:=$f/@name/fn:string()
 | 
				
			||||||
    let $type:=$f/@type/fn:string()
 | 
					    let $type:=$f/@type/fn:string()
 | 
				
			||||||
    let $opt:=fn:contains($type,"?")
 | 
					    let $opt:=fn:contains($type,"?")
 | 
				
			||||||
    let $repeat:=fn:contains($type,"*")
 | 
					    let $repeat:=fn:contains($type,"*")
 | 
				
			||||||
    let $json-type:=json-type($type)
 | 
					    let $json-type:=bf:json-type($type)
 | 
				
			||||||
    let $mult:=if($repeat) then "*" else "?"
 | 
					    let $mult:=if($repeat) then "*" else "?"
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    let $at:=if($json-type ne "string") 
 | 
					    let $at:=if($json-type ne "string") 
 | 
				
			||||||
| 
						 | 
					@ -149,7 +149,7 @@ as xs:string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(:~ convert xs type to json
 | 
					(:~ convert xs type to json
 | 
				
			||||||
:)
 | 
					:)
 | 
				
			||||||
declare function json-type($xsd as xs:string) as xs:string{
 | 
					declare function bf:json-type($xsd as xs:string) as xs:string{
 | 
				
			||||||
switch ($xsd)
 | 
					switch ($xsd)
 | 
				
			||||||
   case "element()" return "string" 
 | 
					   case "element()" return "string" 
 | 
				
			||||||
   case "xs:boolean" return "boolean"
 | 
					   case "xs:boolean" return "boolean"
 | 
				
			||||||
| 
						 | 
					@ -161,28 +161,28 @@ switch ($xsd)
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(:~ declare any namespaces found :)
 | 
					(:~ declare any namespaces found :)
 | 
				
			||||||
declare function build-namespaces($entities as element()*)
 | 
					declare function bf:build-namespaces($entities as element()*)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  for $n in distinct-deep($entities/ent:namespace)
 | 
					  for $n in bf:distinct-deep($entities/ent:namespace)
 | 
				
			||||||
  return 
 | 
					  return 
 | 
				
			||||||
<text>declare namespace {$n/@prefix/fn:string()}='{$n/@uri/fn:string()}';
 | 
					<text>declare namespace {$n/@prefix/fn:string()}='{$n/@uri/fn:string()}';
 | 
				
			||||||
</text>
 | 
					</text>
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(:~ import any modules found must be in repo :)
 | 
					(:~ import any modules found must be in repo :)
 | 
				
			||||||
declare function build-imports($entities as element()*)
 | 
					declare function bf:build-imports($entities as element()*)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  for $n in distinct-deep($entities/ent:module)
 | 
					  for $n in bf:distinct-deep($entities/ent:module)
 | 
				
			||||||
  return 
 | 
					  return 
 | 
				
			||||||
<text>import module namespace {$n/@prefix/fn:string()}='{$n/@namespace/fn:string()}';
 | 
					<text>import module namespace {$n/@prefix/fn:string()}='{$n/@namespace/fn:string()}';
 | 
				
			||||||
</text>
 | 
					</text>
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
declare function build-describe($entities)
 | 
					declare function bf:build-describe($entities)
 | 
				
			||||||
as xs:string
 | 
					as xs:string
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  let $m:=for $e in  $entities
 | 
					  let $m:=for $e in  $entities
 | 
				
			||||||
          return generate($e)
 | 
					          return bf:generate($e)
 | 
				
			||||||
  return <text>          
 | 
					  return <text>          
 | 
				
			||||||
declare variable $entity:list:=map {{ {fn:string-join($m,",")}
 | 
					declare variable $entity:list:=map {{ {fn:string-join($m,",")}
 | 
				
			||||||
}};
 | 
					}};
 | 
				
			||||||
| 
						 | 
					@ -190,7 +190,7 @@ declare variable $entity:list:=map {{ {fn:string-join($m,",")}
 | 
				
			||||||
</text>        
 | 
					</text>        
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
declare function escape($str as xs:string) 
 | 
					declare function bf:escape($str as xs:string) 
 | 
				
			||||||
as xs:string
 | 
					as xs:string
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
   fn:replace(
 | 
					   fn:replace(
 | 
				
			||||||
| 
						 | 
					@ -200,15 +200,15 @@ as xs:string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(:-----from functx-------------------:)
 | 
					(:-----from functx-------------------:)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 declare function distinct-deep 
 | 
					 declare function bf:distinct-deep 
 | 
				
			||||||
  ( $nodes as node()* )  as node()* {
 | 
					  ( $nodes as node()* )  as node()* {
 | 
				
			||||||
       
 | 
					       
 | 
				
			||||||
    for $seq in (1 to fn:count($nodes))
 | 
					    for $seq in (1 to fn:count($nodes))
 | 
				
			||||||
    return $nodes[$seq][fn:not(is-node-in-sequence-deep-equal(
 | 
					    return $nodes[$seq][fn:not(bf:is-node-in-sequence-deep-equal(
 | 
				
			||||||
                          .,$nodes[fn:position() < $seq]))]
 | 
					                          .,$nodes[fn:position() < $seq]))]
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
declare function is-node-in-sequence-deep-equal 
 | 
					declare function bf:is-node-in-sequence-deep-equal 
 | 
				
			||||||
  ( $node as node()? ,
 | 
					  ( $node as node()? ,
 | 
				
			||||||
    $seq as node()* )  as xs:boolean {
 | 
					    $seq as node()* )  as xs:boolean {
 | 
				
			||||||
       
 | 
					       
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@
 | 
				
			||||||
 :)
 | 
					 :)
 | 
				
			||||||
module namespace vue-api = 'quodatum:vue.api';
 | 
					module namespace vue-api = 'quodatum:vue.api';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import module namespace bf = 'quodatum.tools.buildfields' at "./../../../lib/entity-gen.xqm";
 | 
					import module namespace bf = 'quodatum.tools.buildfields' at "entity-gen.xqm";
 | 
				
			||||||
import module namespace query-a = 'vue-poc/query-a' at "../../../lib/query-a.xqm";
 | 
					import module namespace query-a = 'vue-poc/query-a' at "../../../lib/query-a.xqm";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
declare variable $vue-api:query:="tx-model.xq";
 | 
					declare variable $vue-api:query:="tx-model.xq";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
 : Update `generated/models.xqm` from XML files in `data/models`
 | 
					 : Update `generated/models.xqm` from XML files in `data/models`
 | 
				
			||||||
 :)
 | 
					 :)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import module namespace bf = 'quodatum.tools.buildfields' at "./../../../lib/entity-gen.xqm";
 | 
					import module namespace bf = 'quodatum.tools.buildfields' at "entity-gen.xqm";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(:~ 
 | 
					(:~ 
 | 
				
			||||||
 : Folder containing model definitions as xml
 | 
					 : Folder containing model definitions as xml
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,7 @@ declare variable $target as xs:anyURI  external
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let $config:='import module namespace cfg = "quodatum:media.image.configure" at "features/images/config.xqm";'
 | 
					let $config:='import module namespace cfg = "quodatum:media.image.configure" at "features/images/config.xqm";'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let $src:=bf:module(bf:entities($efolder),$config)
 | 
					let $src:=bf:module(bf:entities($efolder),$config)
 | 
				
			||||||
return (
 | 
					return (
 | 
				
			||||||
  prof:variables(),
 | 
					  prof:variables(),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
(: entity access maps 
 | 
					(: entity access maps 
 | 
				
			||||||
 : auto generated from xml files in entities folder at: 2020-07-08T23:08:03.678+01:00 
 | 
					 : auto generated from xml files in entities folder at: 2020-09-04T11:37:53.188+01:00 
 | 
				
			||||||
 :)
 | 
					 :)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module namespace entity = 'quodatum.models.generated';
 | 
					module namespace entity = 'quodatum.models.generated';
 | 
				
			||||||
| 
						 | 
					@ -244,51 +244,8 @@ hof:top-k-by(admin:logs(), string#1, 2)
 | 
				
			||||||
       
 | 
					       
 | 
				
			||||||
       }
 | 
					       }
 | 
				
			||||||
   },
 | 
					   },
 | 
				
			||||||
  "entity.field": map{
 | 
					  "dice.entity": map{
 | 
				
			||||||
     "name": "entity.field",
 | 
					     "name": "dice.entity",
 | 
				
			||||||
     "description": "About an entity field. ",
 | 
					 | 
				
			||||||
     "access": map{ 
 | 
					 | 
				
			||||||
       "description": function($_ as element()) as xs:string {$_/ent:description },
 | 
					 | 
				
			||||||
       "name": function($_ as element()) as xs:string {$_/@name },
 | 
					 | 
				
			||||||
       "parent": function($_ as element()) as xs:string {$_/../../@name },
 | 
					 | 
				
			||||||
       "type": function($_ as element()) as xs:string {$_/@type },
 | 
					 | 
				
			||||||
       "xpath": function($_ as element()) as xs:string {$_/ent:xpath } },
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
     "filter": function($item,$q) as xs:boolean{ 
 | 
					 | 
				
			||||||
         some $e in ( $item/@name, $item/ent:description) satisfies
 | 
					 | 
				
			||||||
         fn:contains($e,$q, 'http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive')
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
       "json":   map{ 
 | 
					 | 
				
			||||||
           "description": function($_ as element()) as element(description)? {
 | 
					 | 
				
			||||||
            (: xs:string :)
 | 
					 | 
				
			||||||
                        fn:data($_/ent:description)!element description {  .} 
 | 
					 | 
				
			||||||
                 },
 | 
					 | 
				
			||||||
           "name": function($_ as element()) as element(name)? {
 | 
					 | 
				
			||||||
            (: xs:string :)
 | 
					 | 
				
			||||||
                        fn:data($_/@name)!element name {  .} 
 | 
					 | 
				
			||||||
                 },
 | 
					 | 
				
			||||||
           "parent": function($_ as element()) as element(parent)? {
 | 
					 | 
				
			||||||
            (: xs:string :)
 | 
					 | 
				
			||||||
                        fn:data($_/../../@name)!element parent {  .} 
 | 
					 | 
				
			||||||
                 },
 | 
					 | 
				
			||||||
           "type": function($_ as element()) as element(type)? {
 | 
					 | 
				
			||||||
            (: xs:string :)
 | 
					 | 
				
			||||||
                        fn:data($_/@type)!element type {  .} 
 | 
					 | 
				
			||||||
                 },
 | 
					 | 
				
			||||||
           "xpath": function($_ as element()) as element(xpath)? {
 | 
					 | 
				
			||||||
            (: xs:string :)
 | 
					 | 
				
			||||||
                        fn:data($_/ent:xpath)!element xpath {  .} 
 | 
					 | 
				
			||||||
                 } },
 | 
					 | 
				
			||||||
       
 | 
					 | 
				
			||||||
      "data": function() as element(ent:field)*
 | 
					 | 
				
			||||||
       { collection("doc-doc")/ent:entity/ent:fields/ent:field },
 | 
					 | 
				
			||||||
       
 | 
					 | 
				
			||||||
       "views": map{ 
 | 
					 | 
				
			||||||
       'filter': 'name description'
 | 
					 | 
				
			||||||
       }
 | 
					 | 
				
			||||||
   },
 | 
					 | 
				
			||||||
  "entity": map{
 | 
					 | 
				
			||||||
     "name": "entity",
 | 
					 | 
				
			||||||
     "description": "List of Entities i.e. things described in this framework
 | 
					     "description": "List of Entities i.e. things described in this framework
 | 
				
			||||||
	",
 | 
						",
 | 
				
			||||||
     "access": map{ 
 | 
					     "access": map{ 
 | 
				
			||||||
| 
						 | 
					@ -366,6 +323,49 @@ hof:top-k-by(admin:logs(), string#1, 2)
 | 
				
			||||||
      "data": function() as element(ent:entity)*
 | 
					      "data": function() as element(ent:entity)*
 | 
				
			||||||
       { collection("vue-poc")/ent:entity },
 | 
					       { collection("vue-poc")/ent:entity },
 | 
				
			||||||
       
 | 
					       
 | 
				
			||||||
 | 
					       "views": map{ 
 | 
				
			||||||
 | 
					       'filter': 'name description'
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					   },
 | 
				
			||||||
 | 
					  "dice.field": map{
 | 
				
			||||||
 | 
					     "name": "dice.field",
 | 
				
			||||||
 | 
					     "description": "About an entity field. ",
 | 
				
			||||||
 | 
					     "access": map{ 
 | 
				
			||||||
 | 
					       "description": function($_ as element()) as xs:string {$_/ent:description },
 | 
				
			||||||
 | 
					       "name": function($_ as element()) as xs:string {$_/@name },
 | 
				
			||||||
 | 
					       "parent": function($_ as element()) as xs:string {$_/../../@name },
 | 
				
			||||||
 | 
					       "type": function($_ as element()) as xs:string {$_/@type },
 | 
				
			||||||
 | 
					       "xpath": function($_ as element()) as xs:string {$_/ent:xpath } },
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					     "filter": function($item,$q) as xs:boolean{ 
 | 
				
			||||||
 | 
					         some $e in ( $item/@name, $item/ent:description) satisfies
 | 
				
			||||||
 | 
					         fn:contains($e,$q, 'http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive')
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					       "json":   map{ 
 | 
				
			||||||
 | 
					           "description": function($_ as element()) as element(description)? {
 | 
				
			||||||
 | 
					            (: xs:string :)
 | 
				
			||||||
 | 
					                        fn:data($_/ent:description)!element description {  .} 
 | 
				
			||||||
 | 
					                 },
 | 
				
			||||||
 | 
					           "name": function($_ as element()) as element(name)? {
 | 
				
			||||||
 | 
					            (: xs:string :)
 | 
				
			||||||
 | 
					                        fn:data($_/@name)!element name {  .} 
 | 
				
			||||||
 | 
					                 },
 | 
				
			||||||
 | 
					           "parent": function($_ as element()) as element(parent)? {
 | 
				
			||||||
 | 
					            (: xs:string :)
 | 
				
			||||||
 | 
					                        fn:data($_/../../@name)!element parent {  .} 
 | 
				
			||||||
 | 
					                 },
 | 
				
			||||||
 | 
					           "type": function($_ as element()) as element(type)? {
 | 
				
			||||||
 | 
					            (: xs:string :)
 | 
				
			||||||
 | 
					                        fn:data($_/@type)!element type {  .} 
 | 
				
			||||||
 | 
					                 },
 | 
				
			||||||
 | 
					           "xpath": function($_ as element()) as element(xpath)? {
 | 
				
			||||||
 | 
					            (: xs:string :)
 | 
				
			||||||
 | 
					                        fn:data($_/ent:xpath)!element xpath {  .} 
 | 
				
			||||||
 | 
					                 } },
 | 
				
			||||||
 | 
					       
 | 
				
			||||||
 | 
					      "data": function() as element(ent:field)*
 | 
				
			||||||
 | 
					       { collection("doc-doc")/ent:entity/ent:fields/ent:field },
 | 
				
			||||||
 | 
					       
 | 
				
			||||||
       "views": map{ 
 | 
					       "views": map{ 
 | 
				
			||||||
       'filter': 'name description'
 | 
					       'filter': 'name description'
 | 
				
			||||||
       }
 | 
					       }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,10 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	"name": "vue-poc",
 | 
						"name": "vue-poc",
 | 
				
			||||||
	"version": "0.5@2020-07-06",
 | 
						"version": "0.5.2@2020-09-04",
 | 
				
			||||||
	"description": "Frontend vuetify, backend: basex",
 | 
						"description": "App framework experiments, Frontend vuetify, backend: basex",
 | 
				
			||||||
	"dependencies": {
 | 
						"dependencies": {
 | 
				
			||||||
		"ace": "1.4.12",
 | 
							"ace": "1.4.12",
 | 
				
			||||||
		"vuetify": "2.3.7",
 | 
							"vuetify": "2.3.10",
 | 
				
			||||||
		"vue": "2.6.11",
 | 
							"vue": "2.6.11",
 | 
				
			||||||
		"vuex": "3.1.0",
 | 
							"vuex": "3.1.0",
 | 
				
			||||||
		"vue-router": "3.1.6",
 | 
							"vue-router": "3.1.6",
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@
 | 
				
			||||||
		"qs": "6.4.0",
 | 
							"qs": "6.4.0",
 | 
				
			||||||
		"localforage": "1.7.1",
 | 
							"localforage": "1.7.1",
 | 
				
			||||||
		"momentjs": "2.24.0",
 | 
							"momentjs": "2.24.0",
 | 
				
			||||||
		"vuetify-jsonschema-form": "0.35.0",
 | 
							"@koumoul/vjsf": "1.10.0",
 | 
				
			||||||
		"prism": "1.15.0",
 | 
							"prism": "1.15.0",
 | 
				
			||||||
		"vue-prism-component": "1.1.1",
 | 
							"vue-prism-component": "1.1.1",
 | 
				
			||||||
		"vis-timeline-graph2d": "4.20.1",
 | 
							"vis-timeline-graph2d": "4.20.1",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
// generated 2020-09-01T22:40:57.014+01:00
 | 
					// generated 2020-09-04T12:21:45.271+01:00
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-autoheight.vue
 | 
					// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-autoheight.vue
 | 
				
			||||||
Vue.component('qd-autoheight',{template:` 
 | 
					Vue.component('qd-autoheight',{template:` 
 | 
				
			||||||
| 
						 | 
					@ -2322,7 +2322,7 @@ const Logadd=Vue.extend({template:`
 | 
				
			||||||
         var data={message: this.message,
 | 
					         var data={message: this.message,
 | 
				
			||||||
               type: this.type,
 | 
					               type: this.type,
 | 
				
			||||||
               checkbox: this.checkbox};
 | 
					               checkbox: this.checkbox};
 | 
				
			||||||
         HTTP.post("log/add",Qs.stringify(data))
 | 
					         HTTP.post("basex.log/add",Qs.stringify(data))
 | 
				
			||||||
      .then(r=>{
 | 
					      .then(r=>{
 | 
				
			||||||
        console.log("submit: ",data);
 | 
					        console.log("submit: ",data);
 | 
				
			||||||
        if(this.checkbox){
 | 
					        if(this.checkbox){
 | 
				
			||||||
| 
						 | 
					@ -2379,7 +2379,7 @@ const Log=Vue.extend({template:`
 | 
				
			||||||
            </v-list>
 | 
					            </v-list>
 | 
				
			||||||
          </v-menu>
 | 
					          </v-menu>
 | 
				
			||||||
    </v-toolbar>
 | 
					    </v-toolbar>
 | 
				
			||||||
  <v-data-table :headers="headers" :items="items" :search="search" class="elevation-1" no-data-text="No logs found" v-bind:options.sync="pagination">
 | 
					  <v-data-table :headers="headers" :items="items" :search="search" class="elevation-1" no-data-text="No logs found" sort-by="time" v-bind:options.sync="pagination">
 | 
				
			||||||
    <template slot="items" slot-scope="props">
 | 
					    <template slot="items" slot-scope="props">
 | 
				
			||||||
      <td :title="props.item.time">{{ props.item.time  }}</td>
 | 
					      <td :title="props.item.time">{{ props.item.time  }}</td>
 | 
				
			||||||
      <td class="text-xs-right">{{ props.item.user }}</td>
 | 
					      <td class="text-xs-right">{{ props.item.user }}</td>
 | 
				
			||||||
| 
						 | 
					@ -2409,7 +2409,7 @@ const Log=Vue.extend({template:`
 | 
				
			||||||
        { text: 'address', value: 'address' },
 | 
					        { text: 'address', value: 'address' },
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      items:[],
 | 
					      items:[],
 | 
				
			||||||
      pagination:{sortBy: 'time',descending:true,rowsPerPage:25},
 | 
					      pagination:{ rowsPerPage:25},
 | 
				
			||||||
      selected:[],
 | 
					      selected:[],
 | 
				
			||||||
      search:"",
 | 
					      search:"",
 | 
				
			||||||
      loading:false,
 | 
					      loading:false,
 | 
				
			||||||
| 
						 | 
					@ -5499,7 +5499,7 @@ const Entity=Vue.extend({template:`
 | 
				
			||||||
			 <v-text-field prepend-icon="filter_list" label="Filter..." v-model="q" type="search" hide-details single-line @keyup.enter="setfilter" clearable></v-text-field>
 | 
								 <v-text-field prepend-icon="filter_list" label="Filter..." v-model="q" type="search" hide-details single-line @keyup.enter="setfilter" clearable></v-text-field>
 | 
				
			||||||
		   <v-spacer></v-spacer>
 | 
							   <v-spacer></v-spacer>
 | 
				
			||||||
			 <v-btn @click="getItems" icon :loading="loading" :disabled="loading"><v-icon>refresh</v-icon></v-btn>
 | 
								 <v-btn @click="getItems" icon :loading="loading" :disabled="loading"><v-icon>refresh</v-icon></v-btn>
 | 
				
			||||||
		   <vp-entitylink entity="entity"></vp-entitylink>
 | 
							   <vp-entitylink entity="dice.entity"></vp-entitylink>
 | 
				
			||||||
	 </v-toolbar>
 | 
						 </v-toolbar>
 | 
				
			||||||
	 </template>
 | 
						 </template>
 | 
				
			||||||
	 
 | 
						 
 | 
				
			||||||
| 
						 | 
					@ -5639,7 +5639,7 @@ const Entity1=Vue.extend({template:`
 | 
				
			||||||
	          </v-layout>
 | 
						          </v-layout>
 | 
				
			||||||
	      </v-expansion-panel-header> 
 | 
						      </v-expansion-panel-header> 
 | 
				
			||||||
	      <v-expansion-panel-content>
 | 
						      <v-expansion-panel-content>
 | 
				
			||||||
	           <qd-table :headers="headers" :data-uri=""data/entity/"+entity +"/field"" entity="entity.field" no-data-msg="Nothing found">
 | 
						           <qd-table :headers="headers" :data-uri=""data/entity/"+entity +"/field"" entity="dice.field" no-data-msg="Nothing found">
 | 
				
			||||||
	          </qd-table>
 | 
						          </qd-table>
 | 
				
			||||||
	      </v-expansion-panel-content>
 | 
						      </v-expansion-panel-content>
 | 
				
			||||||
	     </v-expansion-panel>
 | 
						     </v-expansion-panel>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue