Presentation is loading. Please wait.

Presentation is loading. Please wait.

A SParqly Jython++ A SParqly Jython++ an ASP/SPARQL enhanced Jython Cliff Cheng Carlos Urrutia Francisco Garcia.

Similar presentations


Presentation on theme: "A SParqly Jython++ A SParqly Jython++ an ASP/SPARQL enhanced Jython Cliff Cheng Carlos Urrutia Francisco Garcia."— Presentation transcript:

1 A SParqly Jython++ A SParqly Jython++ an ASP/SPARQL enhanced Jython Cliff Cheng Carlos Urrutia Francisco Garcia

2 Summary Improving ASPJython++ by incorporating homeworks. (SPARQL not fully supported, joins, update, delete, etc,.) Added syntax to be allow conversion of a RDF database into ASP/Prolog facts by returning a Tuple. Added syntax to be able to create RDF table from SQL table, using the Tuple as the return type. Use of Oracle Sequence as a GUID.

3 Phyton.g These tokens behave like the regular SELECT. The grammar will check for syntax correctness. Since the format of ASPSELECT and RDFSELECT is similar as SELECT, we just treated them as SQL grammar, which implies no need to build a node of type Tuple (Tuple.java) because SQL node were already created by Frank, and so the conversion of the nodes into python objects(CodeCompiler.java).... | (ASPSELECT sqlquery SEMI {$sql_stmt::strings.add($sql_stmt::temp); } -> ^(ASPSELECT [$sql_stmt.start, actions.castExprs($sql_stmt::exprs), $expr::ctype,$sql_stmt::strings, $connection::url, $connection::uname, $connection::pword])) | (RDFSELECT sqlquery SEMI {$sql_stmt::strings.add($sql_stmt::temp); } -> ^(RDFSELECT [$sql_stmt.start, actions.castExprs($sql_stmt::exprs), $expr::ctype,$sql_stmt::strings, $connection::url, $connection::uname, $connection::pword])) … //new Tokens to help get ASP/Prolog facts ASPSELECT :'ASPSELECT'; RDFSELECT :'RDFSELECT';

4 PyTuple.java Here is where Tuples get evaluated. The use of ASPSELECT is to indicate weather we return the RDF “triple” parsed into (SUB, PRED, OBJ) without the RDF format, to be used by end users to create ASP/Prolog facts. RDFSELECT is used to create an RDF table from a SQL table. But this new created syntax are best used with *, because ASPSELECT uses an RDF database, so you probably want to get the whole tuple as (SUB, PRED, OBJ) Note: This does not mean it only works with *. Sample syntax: ASPSELECT * FROM SOMETABLE; ASPSELECT * FROM SOMETABLE; RDFSELECT * FROM SOMETABLE; RDFSELECT * FROM SOMETABLE;

5 PyTuple.java (some code) PyTuple.java PyTuple.java PyTuple.java

6 Oracle Sequence ASPSELECT In order for ASPSELECT to work properly, the way the guid was implemented for the INSERT statements had to be modified. INSERT Before: every separate session's INSERT to the same RDF table would reset the guid to 1, since there will not be prior records of the last guid used. Now: Oracle sequence: What is an Oracle sequence? A sequence is an object in Oracle to generate a number sequence. Useful to act as a primary key, here for our guid.

7 Oracle Sequnce Syntax CREATE SEQUENCE sequence_name MINVALUE value MAXVALUE value START WITH value INCREMENT BY value CACHE value; Way implemented: //Create sequence stmt.executeQuery("CREATE SEQUENCE "+caststmt.getTable()+"_RDF_DATA_sqnc MINVALUE 1 START WITH 1 INCREMENT BY 1 NOCACHE"); //Drop sequence stmt.executeQuery("DROP SEQUENCE "+caststmt.getName()+"_RDF_DATA_sqnc"); //To get next value in sequence OracleResultSet rs2 = (OracleResultSet)stmt.executeQuery("SELECT " + tableName + "_RDF_DATA_sqnc.nextval FROM dual");

8 Concepts Tokens Terminal Non-terminal Context-Free grammar Abstract Syntax Tree ASP/Prolog facts and rules SQL SPARQL RDF Concepts

9 Improvements Keep working on fully supporting SPARQL (joins,delete,update) Make ASP/Prolog more dynamic Keep integrating more languages(Lisp, Haskell, etc) :-)


Download ppt "A SParqly Jython++ A SParqly Jython++ an ASP/SPARQL enhanced Jython Cliff Cheng Carlos Urrutia Francisco Garcia."

Similar presentations


Ads by Google