DRAFT 2: Built-Ins

From: [email protected]
Date: 06/03/03

  • Next message: Benjamin Grosof: "my notes from today's JC telecon"
    Hi all,
    
    attached, please find an updated draft for the built-ins.
    
    Regards,
    
    Said
    
    
    
    		RuleML and DAML Rules Built-ins
    		DRAFT 2
    
    		Said Tabet, Benjamin Grosof and Harold Boley
    		06/03/2003
    
    
    This document describes a proposed preliminary list of built-ins for RuleML and DAML Rules. 
    The approach we are taking is to focus on an initial set of functions and operators 
    before extending this list to more advanced built-ins dealing with URIs, 
    external APIs and other custom functionality.
    
    Next steps:
    	- We could define these built-ins in terms of sensors and effectors (as defined by Benjamin)
    	I suggest we go beyond this classification and exercise the use of OWL to define a Taxonomy
    	of the built-ins we are considering. Some built-ins could be derived from base ones and 
    	defined by the user ("user-defined built-ins")
    
    	- We can also think in terms of "Primitive" and "Derived" built-ins.
    
    	- Another important item: using URI references to uniquely address each built-in. We need to
    	agree on a way to construct these references (see XML schema Datatypes, use of namespaces).
    
    We organize the proposed list into subsets of built-ins:
    
    
    1. Elementary Arithmetic built-ins:
    ----------------------------
    	1.1	Addition:			+
    	1.2	Substraction:		-
    	1.3	Multiplication:		*
    	1.4	Division:			/
    
    2. Comparaison built-ins:
    ------------------------
    	2.1	Greater Than		>
    	2.2	Less Than			<
    	2.3	Equal				==
    	2.4	Less Than or Equal	<=
    	2.5	Greater Than or Equal	>=
    	2.6	Not Equal			!=
    
    3. More Built-ins:
    ----------------
    	3.1	Assign			=	(may not be required in our first version)
    	3.2	Increment			++
    	3.3	Decrement			--
    	3.4	Power				**
    	3.5	Abs (absolute value)
    	3.6	Min
    	3.7	Max
    	3.8	Mod (remainder from doing a div)
    	3.9	bitAnd		Performs the bitwise AND on its integer arguments
    	3.10	bitNot		Performs the bitwise NOT on its integer argument
    	3.11	bitOr			Performs the bitwise OR on its integer arguments
    	3.12	log			returns the logarithm base e of its only argument
    	3.13	log10			returns the logarithm base 10 of its only argument
    	3.14	random		returns a pseudo random integer between 0 and a max value Int32(?)
    	3.15	round
    	3.16	sqrt			returns the square root of its only argument
    
    
    4. Data Types
    --------------
    	Our approach is to integrate XML Part 2, Data Types:
    	http://www.w3.org/TR/xmlschema-2/
    
    	We need some examples of the types of built-ins we would use with these data types.
    	Is that enough?
    	Example: Duration (as pointed by Sandro on 5/29/03) can be used with comparison and other
    	built-ins such as calculation. 
    
    5. String built-ins:
    -----------------
    	5.1	strLength		returns the length of a given string in characters
    	5.2	strCat		string concatenation
    	5.3	strCompare		compares 2 strings
    	5.4	strIndex		returns the position of the first argument within the second argument
    	5.5	isString		returns TRUE if the argument is a string, FALSE otherwise
    					The same functionality may be obtaind by a test on the class String
    	5.6	subString		returns a substring from a string argument given two 1-based indices
    	5.7	strUpcase		returns the given string argument in Uppercase
    	5.8	str-lowcase		retrns the given string argument in lowercase
    	5.9	str-startswith	returns TRUE if the first string starts with the provided 2nd string
    
    
    6. URI and I/O Streams built-ins
    --------------------------------
    	6.1	open			Open a file or a stream
    	6.2	read			Read from stream or file
    	6.3	write			Write to a stream or file
    	6.4	close			close file or stream
    	6.5	printout		sends unformatted output to a given stream/router
    	9.1	document		returns an XML or RDF document given a URI
    	9.2	serialize		serialize an object into a file (XML, RDF, OWL, other format, etc.)
    	9.3	deserialize		deserialize a document (XML, RDF, OWL, etc.) into an object
    
    	
    7. Control and debugging built-ins:
    -----------------------------------
    NOTE: 
    These may be considered in an API outside of the scope of our built-ins hierarchy.
    However, many implementations in Prolog and production systems consider them as built-ins.
    
    
    	7.1	run			invoke an inference cycle
    	7.2	query			run a query
    	7.3	halt			halts an inference/query cycle
    	7.4	reset			reset the fact base
    	7.5	show-facts		returns the list of asserted facts
    	7.5	show-rules		returns the list of rules
    	7.8	debug			runs in a debug mode: traces all rule firings
    	7.9	assert		assert new facts
    	7.10	retract		retract facts
    	7.11	load-facts		asserts facts loaded from a file
    	7.12	load-rules		loads rules from a file
    	7.13	evaluate		evaluates a string input as command line input and returns the result
    	7.14	clear			clear engine from all its contents: rules, facts, etc.
    	
    8. External objects and pointers access built-ins
    -------------------------------------------------
    
    Objects can be viewed as documents and therefore apply the same built-ins as what we use for URIs and
    web documents. A URI can be used as an object identifier.
    Any feedback?
    
    9. Built-ins for modules handling
    ---------------------------------
    	9.1	setModule		set the current module to the module provided as an argument
    	9.2	getModule		returns the current module in focus
    	9.3	listModules		returns a list of declared modules
    


    This archive was generated by hypermail 2.1.4 : 06/03/03 EST