[MediaWiki-l] Help with SWM

Larry Martell larry.martell at gmail.com
Thu Feb 11 15:01:37 UTC 2016


On Thu, Feb 11, 2016 at 7:42 AM, Larry Martell <larry.martell at gmail.com> wrote:
> On Thu, Feb 11, 2016 at 3:51 AM, Markus Krötzsch
> <markus at semantic-mediawiki.org> wrote:
>> Hi Larry,
>>
>> in general, the best place to ask SMW questions is the semediawiki-user
>> mailing list. Quick answers below:
>
> Thank you very much Markus for the reply. There is a lot of very
> helpful info here. I have moved this discussion over to that list. I
> hope you are on that list too and can continue to help me.
>
>
>> On 11.02.2016 04:16, Larry Martell wrote:
>>>
>>> I am a total newbie with SMW, and I've inherited a system that no one
>>> knows any details about.
>>>
>>> I have a few questions:
>>>
>>> How can I find out what and where the database behind the SMW is? I
>>> would think there is a config file somewhere, but I can't find it.
>>
>>
>> The data is stored in the database you have configured for your wiki. The
>> config file where this is defined is LocalSettings.php. You can
>> (additionally) store it in an RDF database if you wish (for this, you need
>> to install such a database management system and add some config options;
>> see SMW documentation).
>>
>>>
>>> When I look at a page with browsebysubject I see a type associated
>>> with the data, e.g.:
>>>
>>> {u'property': u'HasSide', u'dataitem': [{u'item': u'Left', u'type': 2}]}
>>> {u'property': u'HasReferenceDataset', u'dataitem': [{u'item':
>>> u'RefData, u'type': 9}]}
>>>
>>> What do these types mean?
>>
>>
>> This is probably not relevant to what you want to do.
>>
>>>
>>> I have been asked to edit 1000's of pages to remove 2 fields and add a
>>> new field.
>>
>>
>> Take a look at the extension ReplaceText. It can probably do this for you.
>>
>>> To do this with the API would I get the data with
>>> browsebysubject and modify that dict? But then how would I write that
>>> back?
>>>
>>> Or would I get the raw data with index.php?action=raw, modify that,
>>> and then write it back with edit
>>> (https://www.mediawiki.org/wiki/API:Edit)
>>
>>
>> An easier way to modify page texts in a one-time operation might be to
>> export the text using Special:Export, modify the resulting XML file with any
>> tool you like, and then re-import the file. Won't work well if your wiki is
>> edited by many people, but if you have the modification script ready you
>> could do this in a few minutes, which is good enough on a relatively static
>> site.
>>
>> Whatever method you pick, changing the page text in one or the other way it
>> the right way of changing SMW data. SMW's primary data storage is the page
>> text, so you do not need to worry about any specific database related to
>> SMW: the extension will make sure that its contents is updated to agree with
>> the page text. *Never* edit SMW's database tables directly. Your changes
>> will be lost as soon as the wiki pages are edited next time.
>
> I am wondering why the changes I made are not being seen on the pages.
> I do see my changes when I export the pages but not when viewing them.
>
> For example, before, a page had this:
>
> |Type=Foo
> |Side=Right
>
> and I changed it to this:
>
> |Side Type=Right Foo
>
> But on the page I see this:
>
> Type
> Side
>
> With no data after the field names (whereas before the data was shown
> after each field name).
>
> I made those changes by pulling the raw data and writing it back with edit.
>
> Then I tried the export/import method, but when I tried to import the
> modified page, I got "No revisions imported (all were either already
> present, or skipped due to errors)."
>
> I did make changes, so there must have been errors. How could I see
> what those errors are?
>
> Also I changed the form from this:
>
> ! Type:
> | {{{field|Type}}}
> |-
> ! Side:
> | {{{field|Side}}}
> |-
>
> To this:
>
> ! Side Type:
> | {{{field|Side Type}}}
> |-
>
> But that is not reflected in the pages either.
>
> What am I missing here?

I figured this out - I had to also change the template, not just the
form. Also, exporting, modifying the XML and importing did not work. I
did it with raw and edit.



More information about the MediaWiki-l mailing list