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

Reply via email to