Semanticmediawiki: SMW properties not shown when creating pages through code

Created on 27 Mar 2019  路  2Comments  路  Source: SemanticMediaWiki/SemanticMediaWiki

Setup and configuration

  • SMW version: 2.5.7
  • MW version: 1.27.4
  • PHP version: 5.6.39-1+ubuntu16.04.1+deb.sury.org+1
  • DB system MySQL (Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using EditLine wrapper)

Issue

We have a plugin that exports existing pages in to .wiki files and makes it possible to import them later on. Pages are created through new WikitextContent()->doEditContent(). When importing several packages (of .wiki files) the Special:SMWAdmin 'refreshJob'-button should be used before the imported data is actually correctly viewable, otherwise the pages do not contain the semantic properties while viewing them.

Running the refreshData-maintenance script on the command line does not work efficiently as the button does.

So I've got a couple of questions;

  • is there someway to call the refreshJob for a single title?
  • What is the difference between running the refreshData on the command line or through Special:SMWAdmin?
  • What does the refreshJob-action acutally do? Does it call newUpdateJob, newUpdateDispatcherJob, ect?

Now the refreshJob does solve the problem, but we really don't want to execute the script everytime when there was a import..

question

Most helpful comment

  • SMW version: 2.5.7
    --MW version: 1.27.4

Just to clarify, I won't provide support for an outdated version.

I don't remember (or better I don't have the time to sift through old
code) but it could be this version already checks the revision state
and is skipping an update (keeping a cache entry for 1h mostly to
avoid running twice due to [2] but that will change in SMW 3.1 where
we keep track of the rev_id in the object table) when the revision was
seen before therefore the FORCED_UPDATE option is the recommended
option to skip the skipping.

  • Import your content per title
  • Call the JobFactory, create an instance of the UpdateJob for the
    specific title and use FORCED_UPDATE as parameter [1]
  • is there someway to call the refreshJob for a single title?

Yes, there is but is not for external use.

  • What does the refreshJob-action acutally do? Does it call newUpdateJob,
    newUpdateDispatcherJob, ect?

The refreshJob bundles a couple of IDs to be run as dispatching
instances for the rebuilder which ultimately calls the UpdateJob.

  • What is the difference between running the refreshData on the command
    line or through Special:SMWAdmin?

The command line execution of rebuildData calls the rebuilder
directly which in the final state calls the UpdateJob.

Now the refreshJob does solve the problem, but we really don't want to
execute the script everytime when there was a import..

Right, if at all you should work with the UpdateJob.

The UpdateJob is the only instance that will parse the content of a
page and will invoke Store::updateData process.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/src/Importer/ContentCreators/TextContentCreator.php#L109-L128
[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/3.0.x/src/MediaWiki/Hooks/UserChange.php#L69-L77
[2] https://github.com/wikimedia/mediawiki/blob/master/includes/jobqueue/jobs/EnqueueJob.php

On 3/27/19, Youri vd Bogert notifications@github.com wrote:

Setup and configuration

  • SMW version: 2.5.7
    --MW version: 1.27.4
  • PHP version: 5.6.39-1+ubuntu16.04.1+deb.sury.org+1
  • DB system MySQL (Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using
    EditLine wrapper)

Issue

We have a plugin that exports existing pages in to .wiki files and makes it
possible to import them later on. Pages are created through new WikitextContent()->doEditContent(). When importing several packages (of
.wiki files) the Special:SMWAdmin 'refreshJob'-button should be used before
the imported data is actually correctly viewable, otherwise the pages do not
contain the semantic properties while viewing them.

Running the refreshData-maintenance script on the command line does not work
efficiently as the button does.

So I've got a couple of questions;

  • is there someway to call the refreshJob for a single title?
  • What is the difference between running the refreshData on the command
    line or through Special:SMWAdmin?
  • What does the refreshJob-action acutally do? Does it call newUpdateJob,
    newUpdateDispatcherJob, ect?

Now the refreshJob does solve the problem, but we really don't want to
execute the script everytime when there was a import..

--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/3852

All 2 comments

  • SMW version: 2.5.7
    --MW version: 1.27.4

Just to clarify, I won't provide support for an outdated version.

I don't remember (or better I don't have the time to sift through old
code) but it could be this version already checks the revision state
and is skipping an update (keeping a cache entry for 1h mostly to
avoid running twice due to [2] but that will change in SMW 3.1 where
we keep track of the rev_id in the object table) when the revision was
seen before therefore the FORCED_UPDATE option is the recommended
option to skip the skipping.

  • Import your content per title
  • Call the JobFactory, create an instance of the UpdateJob for the
    specific title and use FORCED_UPDATE as parameter [1]
  • is there someway to call the refreshJob for a single title?

Yes, there is but is not for external use.

  • What does the refreshJob-action acutally do? Does it call newUpdateJob,
    newUpdateDispatcherJob, ect?

The refreshJob bundles a couple of IDs to be run as dispatching
instances for the rebuilder which ultimately calls the UpdateJob.

  • What is the difference between running the refreshData on the command
    line or through Special:SMWAdmin?

The command line execution of rebuildData calls the rebuilder
directly which in the final state calls the UpdateJob.

Now the refreshJob does solve the problem, but we really don't want to
execute the script everytime when there was a import..

Right, if at all you should work with the UpdateJob.

The UpdateJob is the only instance that will parse the content of a
page and will invoke Store::updateData process.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/src/Importer/ContentCreators/TextContentCreator.php#L109-L128
[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/3.0.x/src/MediaWiki/Hooks/UserChange.php#L69-L77
[2] https://github.com/wikimedia/mediawiki/blob/master/includes/jobqueue/jobs/EnqueueJob.php

On 3/27/19, Youri vd Bogert notifications@github.com wrote:

Setup and configuration

  • SMW version: 2.5.7
    --MW version: 1.27.4
  • PHP version: 5.6.39-1+ubuntu16.04.1+deb.sury.org+1
  • DB system MySQL (Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using
    EditLine wrapper)

Issue

We have a plugin that exports existing pages in to .wiki files and makes it
possible to import them later on. Pages are created through new WikitextContent()->doEditContent(). When importing several packages (of
.wiki files) the Special:SMWAdmin 'refreshJob'-button should be used before
the imported data is actually correctly viewable, otherwise the pages do not
contain the semantic properties while viewing them.

Running the refreshData-maintenance script on the command line does not work
efficiently as the button does.

So I've got a couple of questions;

  • is there someway to call the refreshJob for a single title?
  • What is the difference between running the refreshData on the command
    line or through Special:SMWAdmin?
  • What does the refreshJob-action acutally do? Does it call newUpdateJob,
    newUpdateDispatcherJob, ect?

Now the refreshJob does solve the problem, but we really don't want to
execute the script everytime when there was a import..

--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/3852

Thanks for leading me in the right direction James. I've worked out a fix to our problem.

Was this page helpful?
0 / 5 - 0 ratings