Last modified: 2010-08-30 16:21:52 UTC
Hi I tried to read the data after to move a page so I use two times the function getSemanticData. //save new page $newpage = SMWDataValueFactory::newTypeIDValue( '_wpg' ); $newpage->setValues( $newtitle->getDBkey(), $newtitle->getNamespace(), $pageid ); $semdata1 = $this->getSemanticData( $newpage ); $this->_update($semdata1); // Save the old page $oldpage = SMWDataValueFactory::newTypeIDValue( '_wpg' ); $oldpage->setValues( $oldtitle->getDBkey(), $oldtitle->getNamespace(), $redirid ); $semdata2 = $this->getSemanticData( $oldpage ); $this->_update( $semdata2); BUT $semdata1 and $semdata2 give same triples. I think...the responsable is the function getSMWPageIDandSort. The old and new page has the same ID of getSMWPageIDandSort so getSemanticData give the same data (same cache). bye karima
Quick and dirty fix ... $this->m_semdata = array(); //ADD //save new page $newpage = SMWDataValueFactory::newTypeIDValue( '_wpg' ); $newpage->setValues( $newtitle->getDBkey(), $newtitle->getNamespace(), $pageid ); $semdata1 = $this->getSemanticData( $newpage ); $this->_update($semdata1); $this->m_semdata = array(); //ADD // Save the old page $oldpage = SMWDataValueFactory::newTypeIDValue( '_wpg' ); $oldpage->setValues( $oldtitle->getDBkey(), $oldtitle->getNamespace(), $redirid ); $semdata2 = $this->getSemanticData( $oldpage ); $this->_update( $semdata2); bye karima
I do not yet understand what the problem is. What is "$this" in the above code? I assume you are talking about changing the title of a page by moving it. When you do this, there will be a redirect from the old title to the new title. SMW follows redirects when querying for semantic data. This is a feature that helps to avoid information being lost when the title of a page changes. But you can switch this behaviour off by using the configuration option smwgEqualitySupport (http://semantic-mediawiki.org/wiki/Help:Configuration#smwgQEqualitySupport). But the data that you get for a page that is a redirect is not very interesting anyway. It just says that it is a redirect to the new title.
>The data that you get for a page that is a redirect is not very interesting anyway... except recording the triplets in another database. If the name/URI are different the triplets are different (only put owl:sameAs for the old URI and copy the triplets with the new uri). >This is a feature that helps to avoid information being lost when the title of a page changes. May be there is another tool with the exact replica of the data when I m in my class like the class Rapstore ?
I still have significant problems understanding you, sorry. Could you provide a somewhat more verbose description of your problem? Here are some questions that you may want to address to clarify things: * What are you trying to do? * Is there some SMW function that does not work as documented? * Is this problem visible to users of SMW? Can it be reproduced on sandbox.semantic-mediawiki.org? * What is "$this" in your code snippet? * You talk about "another database". How does this relate to your question? What is your database setup? * You talk about "another tool" with "replica of the data". What data do you mean? What kind of tools are you talking about? * What does RAPStore have to do with all this? Is your problem related to (RDF) storage bindings?
* What does RAPStore OK... it's a class in your project. http://semantic-mediawiki.org/doc/SMW__RAPStore2_8php-source.html * What are you trying to do? I'm developing a new connector for SMW with the triplestore 4store http://www.mediawiki.org/wiki/Extension:LinkedWiki * Is there some SMW function that does not work as documented? I didn't find the documentation but I use the template SMW_RAPStore2.php. * Is this problem visible to users of SMW? Can it be reproduced on sandbox.semantic-mediawiki.org? The lambda user doesn't see this problem. * What is "$this" in your code snippet? it's the class http://github.com/BorderCloud/LinkedWiki/blob/master/class/SMW_LinkedWikiStore.php and this class extends SMWSQLStore2 * You talk about "another database". How does this relate to your question? What is your database setup? Like Rapstore I duplicate the triplets in another database to create an endpoint sparql. * You talk about "another tool" with "replica of the data". What data do you mean? What kind of tools are you talking about? I need to record the triplets in a wiki page in real time. So I need to call an function of SMW to give me the triplets current for one page (in the turtle format without prefix). My dream is a function like this : getExportTurtle(Title $title) => string (format turtle without prefix) I found a hack for the moment but it will be for the next version.