Merge lp:~zorba-coders/zorba/phpapi into lp:zorba

Proposed by William Candillon
Status: Merged
Approved by: Chris Hillery
Approved revision: no longer in the source branch.
Merged at revision: 10622
Proposed branch: lp:~zorba-coders/zorba/phpapi
Merge into: lp:zorba
Diff against target: 24 lines (+4/-1)
2 files modified
ChangeLog (+1/-1)
doc/php/examples/CMakeLists.txt (+3/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/phpapi
Reviewer Review Type Date Requested Status
Rodolfo Ochoa Approve
William Candillon Approve
Matthias Brantner Pending
Review via email: mp+89002@code.launchpad.net

This proposal supersedes a proposal from 2012-01-17.

Commit message

This merge adds the PHP API that was introduced at the PHP Tour 2011.

Description of the change

This merge adds the PHP API that was introduced at the PHP Tour 2011.
It contains a test for it (php2).

From the last merge proposal, the following things have been done:
- Revert bogus change in swig/php/generate_proxy.php.in (renaming of libPrefix to prefix).
- Introduce a STD Iterator for streaming results.
- Make the parseXML() method private.
- Improve importQueryFromURI

The two key tests are:
- php1
- php2

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

- One thing that I don't understand is the relationship with the existing PHP binding.
- The first three changes in swig/php/generate_proxy.php.in should be reverted (renaming of libPrefix to prefix)
- executeToURI is only capable of writing to files. Also, it currently doesn't stream.
- importQueryFromURI only works for file URIs.
- The parse functionality should probably be removed. It merges two functionalities which don't really belong together (retrieving of data and parsing xml). The latter can also be done in XQuery. If this philosophy is to push more functionality into XQuery, the parse functionality should be removed or made symmetric to the existing C++ and XQuery data manager APIs.
- getItem doesn't have a comment and is incomplete. Shouldn't it support more/all XQuery types?

review: Needs Fixing
Revision history for this message
William Candillon (wcandillon) wrote : Posted in a previous version of this proposal

> - One thing that I don't understand is the relationship with the existing PHP binding.
The low level API enables us to extend/debug the XQueryProcessor API more easily.

> - The first three changes in swig/php/generate_proxy.php.in should be reverted (renaming of libPrefix to prefix)
This is fixed in commit 10597.

> - executeToURI is only capable of writing to files. Also, it currently doesn't stream.
This is fixed in commit 10598.

> - importQueryFromURI only works for file URIs.
This is fixed in commit 10600. There is a test for it in commit 10601.

> - The parse functionality should probably be removed. It merges two functionalities which don't really belong together (retrieving of data and parsing xml). The latter can also be done in XQuery. If this philosophy is to push more functionality into XQuery, the parse functionality should be removed or made symmetric to the existing C++ and XQuery data manager APIs.

This is fixed in commit 10598. Unfortunately there two orthogonal things in commit 10598.

> - getItem doesn't have a comment and is incomplete. Shouldn't it support more/all XQuery types?
It should support any kind of PHP type. Currently objects are not supported. Maybe in the futur we will introduce support for objects.

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

Here are some more comments and questions:

* Copyright 2006-2008 The FLWOR Foundation.
=> * Copyright 2006-2012 The FLWOR Foundation.

* Iterate over an instance of the XML Data Model (i.e, a sequence of items).
* This class implements the SPL Iterator interface.

You can only iterate over a sequence of instances of the XDM. The sequence
is not an instance by itself.

* The XQueryProcessor class allows to invoke
* <a href="http://www.zorba-xquery.com">Zorba XQuery Processor</a>.

to invoke _the_ ...

* Instruction to install the extension can be found at <a href=""></a>.

Instruction_s_

* Shutdowns

Shuts down

* In the following code snippet, the following code snippets imports and execute an <em>Hello World</em> query:

confusing sentence

* Import a query to execute from its filename.

Import a query to execute from a file with the given name.

* $xquery->importQueryiFromURI('hello_world.xq');

$xquery->importQueryFromURI('hello_world.xq');

* Filename of the query to execute.

Filename containing the query to execute.

* Set value for an external variable.

Set a value for an external variable.

* The following code snippet sets the value of the variable
* <em>$i</em> with <em>1</em>.

The following code snippet sets the value of the variable
<em>$i</em> to <em>1</em> with type xs:integer.

* The following code snippet sets the value of the variable <em>$i</em> in
* the local namespace with the value <em>1</em>.

The following code snippet sets the value of the variable <em>$i</em> in
the local namespace to the value <em>1</em>.

getIterator and compile() don't have comments. Also, the indentation of compile() and getItem() seem to be broken

Why do you repeat the conversion rules from setVariable in the comment of getItem. Why does one rule include SimpleXMLElement and the other one doesn't?

Did you drop the streaming execution for execute()? If so, why?

review: Needs Fixing
Revision history for this message
William Candillon (wcandillon) wrote : Posted in a previous version of this proposal

Copyright statements are updated in r10603.
All the typos you sent are fixed in r10604.
PHPDoc docs comments are added for compile() and getIterator() in r10605.
The indentation of the compile() and getItem() is fixed in r10606.
r10607 is a fix for the duplicate and inconsistent description of the PHP to XQuery type mapping.
William finds out about IteratorAggregate in r10608 (http://php.net/manual/en/class.iteratoraggregate.php).

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

- Is it on purpose that the only thing that is returned by the iterator is a serialized version of the item? For example, this will return an error for attribute nodes.

- There is a tab at the beginning of

  /**
   * Internal

- Is this wrapper supposed to be merged before the implementation of execute() can stream?

review: Needs Information
Revision history for this message
William Candillon (wcandillon) wrote : Posted in a previous version of this proposal

> - Is it on purpose that the only thing that is returned by the iterator is a
> serialized version of the item? For example, this will return an error for
> attribute nodes.
Yes.
We have two use cases for XQPHP:
- The mobile app which uses execute().
- The google earth demo which uses the iterator.

>
> - There is a tab at the beginning of
>
> /**
> * Internal
>
> - Is this wrapper supposed to be merged before the implementation of execute()
> can stream?
Yes

Revision history for this message
William Candillon (wcandillon) wrote : Posted in a previous version of this proposal

This new proposal is removing unwanted tabs.

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

I'm fine with it now. Before merging, please make sure the change is contained in the ChangeLog. Also, don't mention the obsolete comment in the description or commit message "- Revert bogus change in swig/php/generate_proxy.php.in (renaming of libPrefix to prefix).".

As an aside, importQueryFromURI still allows file system access only. I saw that the comment mentions that but it's still strange.

Revision history for this message
William Candillon (wcandillon) wrote : Posted in a previous version of this proposal

importQueryFromURI() can read any kind of stream and there is even a test for it.
It is commented out so the php tests don't rely on http connections.

Revision history for this message
William Candillon (wcandillon) wrote : Posted in a previous version of this proposal

I've updated the changelog.

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

When I tried it, I was confused about the return value of the iterator. I think it deserves a comment that it return the string value of the current item.

Also a minor typo:

 The following code snippets imports and execute an <em>Hello World</em> query:
=>
 The following code snippets imports and execute_s a_ <em>Hello World</em> query:

review: Needs Fixing
Revision history for this message
Rodolfo Ochoa (rodolfo-ochoa) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
William Candillon (wcandillon) wrote : Posted in a previous version of this proposal

I fixed the typo and added doc comments for the XQueryIterator.

Revision history for this message
Matthias Brantner (matthias-brantner) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Rodolfo Ochoa (rodolfo-ochoa) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/phpapi into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:273 (message):
  Validation queue job phpapi-2012-01-17T19-41-11.72Z is finished. The final
  status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
David Graf (davidagraf) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
William Candillon (wcandillon) :
review: Approve
Revision history for this message
Rodolfo Ochoa (rodolfo-ochoa) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job phpapi-2012-01-18T18-48-01.633Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/phpapi into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job phpapi-2012-01-19T09-02-58.633Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job phpapi-2012-01-19T09-41-08.589Z is finished. The final status was:

All tests succeeded!

lp:~zorba-coders/zorba/phpapi updated
10622. By Chris Hillery

This merge adds the PHP API that was introduced at the PHP Tour 2011. Approved: Rodolfo Ochoa, William Candillon

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-01-18 18:52:26 +0000
3+++ ChangeLog 2012-01-19 09:43:26 +0000
4@@ -28,7 +28,7 @@
5
6 New Features:
7 * New node-position module. This module allows to obtain a representation of a node position, which
8- can be used to assess structural relationships with other nodes.
9+ can be used to assess structural relationships with other nodes.
10 * New node-reference module. References can be obtained for any node, and
11 different nodes cannot have the same identifier.
12 * Custom Full-text thesaurus using Zorba URI resolver mechanism.
13
14=== modified file 'doc/php/examples/CMakeLists.txt'
15--- doc/php/examples/CMakeLists.txt 2012-01-11 08:15:08 +0000
16+++ doc/php/examples/CMakeLists.txt 2012-01-19 09:43:26 +0000
17@@ -31,6 +31,9 @@
18 ADD_TEST("php1" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/simple.php)
19 MESSAGE(STATUS "Installing: " ${CMAKE_CURRENT_BINARY_DIR}/simple.php)
20 ADD_TEST("php2" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/test.php)
21+
22+ EXPECTED_FAILURE(php2 918592)
23+
24 MESSAGE(STATUS "Installing: " ${CMAKE_CURRENT_BINARY_DIR}/test.php)
25
26

Subscribers

People subscribed via source and target branches