Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-dev] Java API for Snap SPARQL, not just the Protege plugin?

Lorenz B. buehmann at informatik.uni-leipzig.de
Thu May 16 22:41:35 PDT 2019


Apache Jena or RDF4J are the de-facto standard Java APIs for SPARQL

Or you just stick to the Snap SPARQL API, an example how to create
parser and use the query engine can be found here [1]

[1]
https://github.com/protegeproject/snap-sparql-query/blob/master/src/main/java/org/semanticweb/owlapi/sparql/ui/TestParser.java

> Is there a Snap SPARQL API for Java that takes a query string
> (formatted like the default query in the Protégé plugin) and returns
> the results?
>
>  
>
> _For example:_
>
>  
>
> String myQuery =
>
> “PREFIX owl: <http://www.w3.org/2002/07/owl#>” +
>
> “PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>” +
>
> “PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> “ +
>
> “ “ +
>
> “SELECT ?x (STR(?lab) AS ?label) WHERE { “ +
>
> “    ?x rdf:type owl:Class . “ +
>
> “    OPTIONAL {?x rdfs:label ?lab} “ +
>
> “}” +
>
> “ORDER BY ?label”;
>
>  
>
> ResultSet myResultSet = magicalSnapSparqlEngine.getResults(myQuery);
>
>  
>
>  
>
> This is what it looks like from the Protégé Snap SPARQL plugin:
>
>  
>
>  
>
>  
>
> FYI: I have a query working that uses the de.derivo.sparqldlapi but
> takes a differently formatted string as input (as far as I can tell).
>
>  
>
> _de.derivo.sparqldlapi example:_
>
>  
>
>    final String query_string = query_prefix +
>
>             "SELECT *\n" +
>
>             "WHERE { \n" +
>
>             "Type(?myPizza, ont:pizza),\n" +
>
>             "Type(?myEffect, ont:effect),\n" +
>
>             "Type(?myGastroProblem, ont:gastroproblem),\n" +
>
>  
>
>             "PropertyValue(?classD, ont:hasEffect, ?myEffect),\n" +
>
>             "PropertyValue(?classD, ont:exhibits, ?myGastroProblem)\n" +
>
>             "};
>
>  
>
>  
>
> I need this to be formatted more like what the Snap SPARQL plugin
> takes as input, so I can test it in Protégé before committing it to
> Java code:
>
>  
>
>    final String query_string = query_prefix +
>
>             "SELECT *\n" +
>
>             "WHERE { \n" +
>
>             "?myPizza a ont:pizza .\n" +
>
>             "?myEffect a ont:effect .\n" +
>
>             "?myGastroProblem a ont:gastroproblem .\n" +
>
>  
>
>             "?classD ont:hasEffect ?myEffect .\n" +
>
>             "?classD ont:exhibits ?myGastroProblem .\n" +
>
>             "};
>
>  
>
> Thanks,
>
>  
>
> -Kenny Cason, CISSP
>
> /Radiance Technologies/
>
> Cyber Solutions Group
>
> 3133 General Hudnell Dr. Ste. 116
> San Antonio, TX 78226
>
> KCason at radiancetech.com <mailto:KCason at radiancetech.com>
>
> 206.550.0049
>
>  
>
>
> _______________________________________________
> protege-dev mailing list
> protege-dev at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-dev

-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-dev/attachments/20190517/8141a6e6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 36192 bytes
Desc: not available
URL: <http://mailman.stanford.edu/pipermail/protege-dev/attachments/20190517/8141a6e6/attachment.jpg>


More information about the protege-dev mailing list