1 / 9

A SParqly Jython++ an ASP/SPARQL enhanced Jython

A SParqly Jython++ an ASP/SPARQL enhanced Jython. Cliff Cheng Carlos Urrutia Francisco Garcia. Summary. Improving ASPJython++ by incorporating homeworks. (SPARQL not fully supported, joins, update, delete, etc,.)

Télécharger la présentation

A SParqly Jython++ an ASP/SPARQL enhanced Jython

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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<Tuple>[$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<Tuple>[$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; • RDFSELECT * FROM SOMETABLE;

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

  6. Oracle Sequence • In order for ASPSELECT to work properly, the way the guid was implemented for the INSERT statements had to be modified. • 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. 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"); Oracle Sequnce Syntax • CREATE SEQUENCE sequence_name • MINVALUE value • MAXVALUE value • START WITH value • INCREMENT BY value • CACHE value;

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

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

More Related