Hi Holger,

Thanks for your reply. 

I need some calcification to execute SPIN function, please refer TYPE 3.

On Wednesday, 15 May 2013 06:08:38 UTC+5:30, Holger Knublauch wrote:
>
>  Hi Leo,
>
> On 5/14/2013 21:17, Leo Anbarasan wrote:
>  
> I have tried many options to execute user defined SPIN functions. But i 
> could not succeed. 
>
> *SPIN Function*:
>  
> SELECT ?users
> WHERE {
>     {
>         SELECT ((GROUP_CONCAT(DISTINCT ?user; SEPARATOR=',')) AS ?users)
>         WHERE {
>             ?user a :Person .
>             ?user :accountAge ?age .
>             FILTER (?age <= 10) .
>         }
>     } .
> }
>
>  *SPARQL Query:*
>
> SELECT (<http://www.semanticweb.org/socure.me/activityOntology#InvalidUser>() 
> AS ?u) {}
>  
> It works fine in TopBraid Composer. But doesn't work in coding. 
>
>  I have tried in 4 methods and everything returns empty result.  They are,
>
>         // TYPE 1
>         registry.registerAll(model, null);
>         String str = "SELECT ?x WHERE { BIND (<
> http://topbraid.org/sparqlmotionfunctions#parseDate>('12/3/11','MM/dd/ 
> yy') as ?x) }";
>         QueryExecution exec = QueryExecutionFactory.create(str, model);
>         
>         ResultSet resultSet = exec.execSelect();
>         ResultSetFormatter.out(resultSet);
>  
>
> The smf:parseDate function is not part of the SPIN API, and only works 
> inside of TopBraid products.
>
>          
>         
>         // TYPE 2
>         Resource queryResource = model.listStatements(null, RDF.type, 
> SP.Select).next().getSubject();
>         Select selectQuery = (Select) SPINFactory.asQuery(queryResource);
>         
>         List<Resource> res = selectQuery.getResultVariables();
>         System.out.println(res.get(0).toString());
>  
>
> What is wrong with this example? The code above is just iterating over all 
> Select query declarations in SPIN RDF syntax, but doesn't execute them. 
> Note that SELECT * may not have any result variables, so res.get(0) seems 
> unsafe.
>
>          
>         // TYPE 3
>         Function function = registry.getFunction("
> http://www.semanticweb.org/socure.me/activityOntology#InvalidUser";, 
> model);
>         registry.registerFunctions(model, function);
>  
>
> I assume you are calling something like in the OWLRLExample:
>
>         // Register any new functions defined in OWL RL
>         SPINModuleRegistry.get().registerAll(owlrlModel, null);
>
> on the correct input model (with imports etc)?
>
>          String query = "SELECT (<
> http://www.semanticweb.org/socure.me/activityOntology#InvalidUser>() AS 
> ?u) {}";
>         
>         QueryExecution exec = QueryExecutionFactory.create(query, model);
>         
>         ResultSet resultSet = exec.execSelect();
>         
>         System.out.println(resultSet.getRowNumber());
>  
>
> Are you getting an error here? Something like missing function registry 
> for your function? If the function is registered correctly then this should 
> work. If not, maybe walk through the code in debugging mode to see why the 
> SPIN API doesn't recognize your function.
>
>
This method return empty result. I have run this in topbraid composer. It 
works fine and return a result. I am not sure about it in API. Could give 
an example to execute SPIN function. 

Awaiting for your reply. 

Thanks,
Leo 

 

> HTH
> Holger
>
>
>          
>         
>         // TYPE 4
>         Query arqQuery = new ARQFactory().createQuery(spinQuery);
>         
>         QueryExecution exec = QueryExecutionFactory.create(arqQuery, 
> model);
>         
>         ResultSet resultSet = exec.execSelect();
>         
>         System.out.println(resultSet.getRowNumber());
>
>   
>  Type 1 is predefined function. Even that is returning empty result. I am 
> not sure whether this is the correct methods. 
>
> If someone could help me resolve this problem.
>
> Awaiting for your reply.
>
> Thanks
> ---
> Leo Anbarasan M
> India
>     -- 
> -- You received this message because you are subscribed to the Google
> Group "TopBraid Suite Users", the topics of which include Enterprise 
> Vocabulary Network (EVN), TopBraid Composer, TopBraid Live,
> TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
> To post to this group, send email to
> [email protected] <javascript:>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>
> For more options, visit this group at
> http://groups.google.com/group/topbraid-users?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>
>
>  

-- 
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live,
TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to