All Downloads are FREE. Search and download functionalities are using the official Maven repository.

template.sql.rul Maven / Gradle / Ivy

Go to download

Corese is a Semantic Web Factory (triple store and SPARQL endpoint) implementing RDF, RDFS, SPARQL 1.1 Query and Update.

There is a newer version: 4.6.1
Show newest version





 

template sql:or {
  ?e
  ; separator = " OR "
}
where {
  ?in rdf:rest*/rdf:first ?e
}
]]>





 

template st:start {
  ?in
  ; separator = "\n\n"
}
where {
  ?in a sql:Query
}
]]>





 

template sql:comma {
  ?e
  ; separator = ", "
}
where {
  ?in rdf:rest*/rdf:first ?e
}
]]>





 

template sql:semicolon {
  ?e
  ; separator = ",\n"
}
where {
  ?in rdf:rest*/rdf:first ?e
}
]]>





 

template sql:and {
  ?e
  ; separator = " AND "
}
where {
  ?in rdf:rest*/rdf:first ?e
}


]]>





 

template sql:line {
  ?e
  ; separator = "\n"
}
where {
  ?in rdf:rest*/rdf:first ?e
}
]]>





 

template {
  ?arg1 "\n" ?label ?arg2 "\n" ?arg3 
}
where {
	?in a ?join ;
	sql:args (?arg1 ?arg2 ?arg3)
}
values (?join ?label) {
	(sql:InnerJoin "INNER JOIN ")
	(sql:FullJoin "FULL OUTER JOIN ")
	(sql:LeftJoin "LEFT JOIN ")
	(sql:RightJoin "RIGHT JOIN ")
}


]]>





 

template {
  ?label st:call-template(sql:comma, ?args)
}
where {
	?in a ?clause ;
	sql:args ?args
}
values (?clause ?label) {
	(sql:From 	"FROM ")
	(sql:GroupBy 	"GROUP BY ")
	(sql:OrderBy 	"ORDER BY ")
	(sql:ListOfValues "")
}

]]>





 

template  {
    "("   
      st:call-template(sql:comma, ?columns) 
    ")"
}
where {     
     	?in a sql:Columns ;
	     sql:args ?columns
    
}



]]>





 

template  {
   st:turtle(?value)
}
where {
  ?in a sql:Constant 
  { ?in sql:label ?value } union
  { ?in sql:value ?value } 
}
]]>





 

template  {
  "VALUES (" st:call-template(sql:comma, ?values)  ")"
}
where {
  ?in a sql:Values ;
     sql:args ?values
}



]]>





 

template  {
  st:call-template(sql:or, ?args)
}
where {
  ?in a sql:Or ;
     sql:args ?args
}
]]>





 

template  {
   " AS " xsd:string(?name) 
}
where {
  ?in a sql:Alias ;
     sql:label ?name
}
]]>





 

template {
  ?label ?arg
}
where {
	?in a ?drop ;
	sql:args ?arg
}
values (?drop ?label) {
	(sql:DropIndex 		"DROP INDEX ")
	(sql:DropTable 		"DROP TABLE ")
	(sql:DropDatabase 	"DROP DATABASE ")
	(sql:TruncateTable  	"TRUNCATE TABLE ")
}
]]>





 

template  {
  ?e
}
where {
  ?in rdf:rest*/rdf:first ?e
}
]]>





 

template  {
	?arg1 " IN (" ?arg2 ")"
}
where {
  ?in a sql:In ;
     sql:args (?arg1 ?arg2)
}



]]>





 

template  {
  ?name 
}
where {
  ?in a sql:As ;
     sql:args ?name
}
]]>





 

template {
"ALTER TABLE " ?arg1 ?label "\n" ?arg2
}
where {
	?in a ?alter ;
	sql:args (?arg1 ?arg2)
}
values (?alter ?label) {
	(sql:AlterTableAdd "ADD ")
	(sql:AlterTableDrop "DROP COLUMN ")
	(sql:AlterTableAlter "ALTER COLUMN ")
}
]]>





 

template {
   ?label "(" 
      st:call-template(sql:comma, ?args)
   ")"
}
where {
	?in a ?function ;
	    sql:args ?args
}
values (?function ?label) {
	(sql:Min   "MIN")
	(sql:Max   "MAX")
	(sql:Avg   "AVG")
	(sql:Last  "LAST")
	(sql:First "FIRST")
	(sql:Count "COUNT")
	(sql:Sum   "SUM")
	(sql:len   "LEN")
	(sql:Upper "UPPER")
	(sql:Lower "LOWER")
}



]]>






@prefix math:  

template  {
  ?arg1 ?label ?arg2
}
where {
	?in a ?ope ;
	  sql:args (?arg1 ?arg2)
}
values (?ope ?label) {
	(math:Mult  " * ")
	(math:Add   " + ")
	(math:Sub   " - ")
	(math:Div   " / ")
	(sql:Equals   " = ")
	(sql:NotEquals   " <> ")
	(sql:GreaterThan   " > ")
	(sql:LessThan   " < ")
	(sql:GreaterEquals   " >= ")
	(sql:LessEquals   " <= ")
	(sql:Between " BETWEEN ")
	(sql:NotBetween " NOT BETWEEN ")
	(sql:Like " LIKE ")
	(sql:NotLike " NOT LIKE ")
	(sql:Union "\nUNION\n")
	(sql:UnionAll "\nUNION ALL\n")
}





]]>





 

template {
  ?label ?args
}
where {
	?in a ?delete ;
	sql:args ?args
}
values (?delete ?label) {
	(sql:Delete 	"DELETE ")
	(sql:Deletestar "DELETE * FROM ")
}
]]>





 

template {
?label ?args
}
where {
	?in a ?create ;
	sql:args ?args
}
values (?create ?label) {
	(sql:CreateTable 	"CREATE TABLE ")
	(sql:CreateDatabase 	"CREATE DATABASE ")
	(sql:CreateIndex 	"CREATE INDEX ")
	(sql:CreateIndexUnique 	"CREATE UNIQUE INDEX ")
}
]]>





 

template  {
    "(\n" 
      st:call-template(sql:semicolon, ?columnstable) 
    "\n)"
}
where {    
     	?in a sql:ColumnsTable ;
	     sql:args ?columnstable     
}



]]>





 

template {
?label ?args
}
where {
	?in a ?clause ;
	sql:args ?args
}
values (?clause ?label) {
	(sql:Where 	"WHERE ")
	(sql:Update 	"UPDATE ")
	(sql:Set 	"SET ")
	(sql:On 	"ON ")
	(sql:Into 	"INTO ")
	(sql:Insert 	"INSERT INTO ")
	(sql:Having 	"HAVING ")
}


]]>





 

template  {
    st:call-template(sql:line, ?body)
    if (! bound(?x), ";", "")
}
where { 
  ?in a sql:Query ;
      sql:args ?body
  optional { ?x ?q ?in }
}



]]>





 

template  {
  st:call-template(sql:and,?args)
}
where {
  ?in a sql:And ;
     sql:args ?args
}
]]>





 

template  {
   xsd:string(?name) 
}
where {
  ?in a sql:Column ;
     sql:label ?name
}
]]>





 

template  {
   xsd:string(?name) 
}
where {
  ?in a sql:Table ;
     sql:label ?name
}
]]>





 

template  {
  	"SELECT " st:call-template(sql:comma, ?select)
}
where {
  ?in a sql:Select ;
     sql:args ?select
}
]]>








© 2015 - 2025 Weber Informatics LLC | Privacy Policy