Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use EasyRDF in sfSkosPlugin, refs #10621 #474

Merged
merged 3 commits into from Dec 20, 2016

Conversation

sevein
Copy link
Member

@sevein sevein commented Nov 29, 2016

@sevein sevein added this to the qa/2.4.x milestone Nov 29, 2016
@qubot qubot force-pushed the dev/issue-10621-skos-easyrdf branch 3 times, most recently from 5b139dc to 29344b1 Compare December 6, 2016 00:04
@qubot qubot force-pushed the dev/issue-10621-skos-easyrdf branch 8 times, most recently from 36a19e0 to c80849c Compare December 7, 2016 06:51
@qubot qubot force-pushed the dev/issue-10621-skos-easyrdf branch 5 times, most recently from d1d4cd1 to 56d3b08 Compare December 19, 2016 23:34
@qubot qubot force-pushed the dev/issue-10621-skos-easyrdf branch from 56d3b08 to d5eeda0 Compare December 20, 2016 06:04
Copy link
Contributor

@jraddaoui jraddaoui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impressive! I've added a few minor comments but it looks great overall.

if (!isset($this->statusId))
{
return 'unknown';
return $unknown;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big deal and I'm not completely sure, but I think that if the statusId is not set it will fall in the switch default case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! I guess this is the result of having switched to Python for a while now, where AttributeError would be raised if you try to access to a member of an object that is not defined. I'll fix it!


if (!isset($this->options['job']))
{
throw new sfException('Missing parameter job');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a native but I think "Missing job parameter" sounds better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree! :D

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehehe thank you!

@@ -17,359 +17,315 @@
* along with Access to Memory (AtoM). If not, see <http://www.gnu.org/licenses/>.
*/

class sfSkosPluginException extends Exception {}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect to find this in a different file, like QubitApiException.class.php

// Get all concepts
$concepts = $skos->xpath->query("skos:Concept | $rdfsel");
$this->i18n = sfContext::getInstance()->i18n;
$this->graph = new EasyRdf_Graph;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could initiate $this->graph after the checks bellow

$this->setScopeNote($term, $concept);
$this->setUriSourceNote($term, $concept);

// Map dc.coverage to term.code for place terms. Hacky Hackerton was here.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually didn't write that! I think it was Jack!

$otherName = new QubitOtherName;
$otherName->typeId = QubitTerm::ALTERNATIVE_LABEL_ID;
$otherName->sourceCulture = $item->getLang();
$otherName->__set('name', $item->getValue(), array('culture' => $lang));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to change it, but I think you can use $otherName->setName($item->getValue(), array('culture' => $lang)); for a little more magic in cases like this

{
continue 2;
}
$relations->insert($c->get('atom:id')->getValue(), $r->get('atom:id')->getValue());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!

// Re-index parent term so numberOfDescendants reflects the changes
if (QubitTerm::ROOT_ID != $this->parent->id)
{
QubitSearch::getInstance()->update($this->parent);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big deal, as the terms are not so big in the ES index, but we could use partial updates in here.

Copy link
Member Author

@sevein sevein Dec 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'd be cool but where would you take the new value from? It'd be weird to instantiate a arElasticSearchTermPdo only for that reason. If I make the calculation then I'm duplicating code. If I use the ORM I'd need to hydrate the object again I believe?
It'd be very nice if the partialUpdate method was able to generate the new value for me in case I don't give him once...

'%1%' => sprintf('<a href="%s">', $this->context->routing->generate(null, array('module' => 'jobs', 'action' => 'report', 'id' => $job->id))),
'%2%' => $job->id,
'%3%' => '</a>'
)), array('persist' => false));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On that particular example I think it's good that it's persisted so it survives to the redirection, right? In any case, there is a total of 16 uses of setFlash... it sounds like we should do that on a separate pull request?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

@@ -0,0 +1,127 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd name it 'uniqueRelationsTest.php'

@qubot qubot force-pushed the dev/issue-10621-skos-easyrdf branch 2 times, most recently from 206ba4c to 7acf7af Compare December 20, 2016 18:14
@jraddaoui
Copy link
Contributor

👍

These are the changes in this commit:

- i18n in Job status
- Link to Job report after import in object/ module
- CSS tweaks
- Stop using `$this` in Qubit.class.php
A new logger called arJobLogger is created by arBaseJob with context about the
current running job. This new logger has been created so it can be injected to
other parts of the application where a logger is accepted so we can capture
their events.

arJobLogger also dispatches logs to `gearman.worker.log` as there is an
observer in `jobWorkerTask.class.php` passing these messages to sfTask so
ultimately they're shown in the standard stream.
@qubot qubot force-pushed the dev/issue-10621-skos-easyrdf branch from 7acf7af to 5ed896b Compare December 20, 2016 18:41
@qubot qubot merged commit 5ed896b into qa/2.4.x Dec 20, 2016
@qubot qubot deleted the dev/issue-10621-skos-easyrdf branch December 20, 2016 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants