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
Conversation
5b139dc
to
29344b1
Compare
36a19e0
to
c80849c
Compare
d1d4cd1
to
56d3b08
Compare
56d3b08
to
d5eeda0
Compare
There was a problem hiding this 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; | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree! :D
There was a problem hiding this comment.
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 {} | |||
|
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you check the persist option in the other flash alerts we set? e.g.: https://github.com/artefactual/atom/blob/qa/2.4.x/apps/qubit/modules/informationobject/actions/updatePublicationStatusAction.class.php#L106
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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'
206ba4c
to
7acf7af
Compare
👍 |
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.
This commit vendors EasyRDF.
7acf7af
to
5ed896b
Compare
Redmine: https://projects.artefactual.com/issues/10621