Re: [SMW-devel] execute #ask query internally
Hey, > I can see the foto 'column' result in the ask query if I var_dump() the result object, but there is no sign of the image file name in there. any ideas? The result object is very deceptive in that regard, and surprised me as well when I first was in a similar situation. It does not contain the actual result. It pretends to by loading the actual data when it's requested from the object. Cheers -- Jeroen De Dauw - http://www.bn2vs.com Software craftsmanship advocate Evil software architect at Wikimedia Germany ~=[,,_,,]:3 -- Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
Re: [SMW-devel] execute #ask query internally
On 06/05/2014 20:37, Jeroen De Dauw wrote: > Hey, > Note that Markus his email is 6 years old, some things have changed since > then :) I'm sure they have! nevertheless, it was one of the few references to internal ask queries that I found. > If what you want to visualize is not the query result of an ask query, then > using the result printer infrastructure is not the way to go. I suggest you > instead create a parser function that has an interface suited for the task at > hand. Once it is clear what the inputs of this function are and what you want > to get out of it, we can determine what the most efficient way to talk to the > SMW store is. That's interesting, maybe the way to go is a parser function, although right now, please forgive me for concentrating fully on my current implementation issue, I have a deadline. :-) As I've started with the SRF printer, I'll finish, maybe later go back and see if something else is more appropriate, taking into account what you say about wikibase. Many times I have wished I was just dealing directly with a database and could just get the data I want and focus on the d3 implementation.. Having said that, the input to the printer is essentually the result of an #ask query, it's all about displaying relationships using D3 graphics. However, I struggled to find how to get ask to give me results like SQL JOINS, and using a template containing further ask queries was messy and doesn't really work, so or the moment, I decided to loop within the printer code to "drill down" and create the relationship tree. I'm still totally stumped on how to deal with the picture file stuff in the ask queries, I can see the foto 'column' result in the ask query if I var_dump() the result object, but there is no sign of the image file name in there. any ideas? Thanks! k/ -- Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce ___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
Re: [SMW-devel] execute #ask query internally
Hey, Note that Markus his email is 6 years old, some things have changed since then :) On a conceptual level, query printers take a query result from an ask query, and create some visualization for that. At least by approximation, the internal code does some odd things at the moment and some printers do further things. This is however where we want to move, and what we will need to do if we want to share result visualization with the Wikibase project. If what you want to visualize is not the query result of an ask query, then using the result printer infrastructure is not the way to go. I suggest you instead create a parser function that has an interface suited for the task at hand. Once it is clear what the inputs of this function are and what you want to get out of it, we can determine what the most efficient way to talk to the SMW store is. At least for me the easiest way to give the feedback/advise you are looking for is if the code is written up to that point, so there is an unambiguous specification of the inputs. Can you post this for review somewhere? Cheers -- Jeroen De Dauw - http://www.bn2vs.com Software craftsmanship advocate Evil software architect at Wikimedia Germany ~=[,,_,,]:3 -- Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
[SMW-devel] execute #ask query internally
[sorry about formatting error on last copy] I'm working on a SRF printer for a d3js force directed graph. I need to execute further #ask queries within my printer in getResultData() I found this post to this mailing list from Markus Krötzsch, which was extremely useful: https://www.mail-archive.com/semediawiki-devel@lists.sourceforge.net/msg00659.html I have pages for Students, and each page has subobjects that describe the classes they are studying. So I #ask for [[-Has subobject::Joe Student]] ( In reality, I will use {{FULLPAGENAME}} ) |?class name That gives me a list of the classes Joe Student is studying, Now I want to loop around the result and get the list of students studying on each class that Joe is in, so I am doing (in the loop): $new_ask_query='[['.$search.'::'.$class.']]'; // $class is current value in result set loop // $search is the PrintRequest from the orginal ask query. ('class name') // The Following mainly pulled from SMW_SpecialAsk.php list( $queryString, $parameters, $printouts ) = SMWQueryProcessor::getComponentsFromFunctionParams( $new_ask_query, false ); $parameters = SMWQueryProcessor::getProcessedParams( $parameters, $printouts ); $myqueryObj=SMWQueryProcessor::createQuery($queryString,$parameters,SMWQueryProcessor::SPECIAL_PAGE,'',$printouts); $myResQueryResult=smwfGetStore()->getQueryResult( $myqueryObj ); $myResults=$myResQueryResult->getResults(); It seems to work fine, but is that the most efficient way of doing it? Now, Where I really need help is if I want to make use of some other properties. If I need a property of the class subobject, I can include it as a PrintRequest in the ask query, so that's OK, but how can I get a property for a result of this second query. (Joe's classmates), like a date of birth for example, which is a property of the page returned as a result of my internal ask query? The post I refer to mentions SMWStore, > Since very recently, SMW in SVN also has a method SMWStore::getSemanticData() > that will retrieve the whole "Factbox" for one page from the store in one > call. That would be great, if I can do that on the results of the ask query! but I need some pointers, so if you can offer either some direct help, or send me to documentation, I would much appreciate it! Hopefully some of this D3 stuff I am doing can then be written well enough to be included in the main distro. Ah... I'm also having a problem with an Image property, it won't show up in ask results at all.. I'm trying to just get the filename to show in broadtable. Any pointers there too appreciated! Thanks! . -- Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce ___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
[SMW-devel] execute #ask query internally
I'm working on a SRF printer for a d3js force directed graph.I need to execute further #ask queries within my printer in getResultData() I found this post to this mailing list from Markus Krötzsch, which was extremely useful:https://www.mail-archive.com/semediawiki-devel@lists.sourceforge.net/msg00659.htmlI have pages for Students, and each page has subobjects that describe the classes they are studying. So I #ask for [[-Has subobject::Joe Student]] ( In reality, I will use {{FULLPAGENAME}} )|?class nameThat gives me a list of the classes Joe Student is studying, Now I want to loop around the result and get the list of students studying on each class that Joe is in, so I am doing (in the loop):$new_ask_query='[['.$search.'::'.$class.']]'; // $class is current value in result set loop// $search is the PrintRequest from the orginal ask query. ('class name')// The Following mainly pulled from SMW_SpecialAsk.phplist( $queryString, $parameters, $printouts ) = SMWQueryProcessor::getComponentsFromFunctionParams( $new_ask_query, false );$parameters = SMWQueryProcessor::getProcessedParams( $parameters, $printouts );$myqueryObj=SMWQueryProcessor::createQuery($queryString,$parameters,SMWQueryProcessor::SPECIAL_PAGE,'',$printouts);$myResQueryResult=smwfGetStore()->getQueryResult( $myqueryObj );$myResults=$myResQueryResult->getResults();It seems to work fine, but is that the most efficient way of doing it?Now, Where I really need help is if I want to make use of some other properties.If I need a property of the class subobject, I can include it as a PrintRequest in the ask query, so that's OK, but how can I get a property for a result of this second query. (Joe's classmates), like a date of birth for example, which is a property of the page returned as a result of my internal ask query?The post I refer to mentions SMWStore, Since very recently, SMW in SVN also has a method SMWStore::getSemanticData() that will retrieve the whole "Factbox" for one page from the store in one call. That would be great, if I can do that on the results of the ask query!but I need some pointers, so if you can offer either some direct help, or send me to documentation, I would much appreciate it! Hopefully some of this D3 stuff I am doing can then be written well enough to be included in the main distro. Ah... I'm also having a problem with an Image property, it won't show up in ask results at all.. I'm trying to just get the filename to show in broadtable. Any pointers there too appreciated!Thanks!. -- Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel