PML example: sparql query

From Inference Web

Jump to: navigation, search

(draft example; see iw:PML Primer for an introduction to PML.)

by: Tim Lebo

See example at: https://github.com/timrdf/csv2rdf4lod-automation/wiki/Script:-cache-queries.sh

First

:myJavascript
    a pmlp:Software;
    # How to say :myJavascript submitted the query?
.
:sparqlQuery_67
    a pmlp:Information;
    pmlp:hasContent "prefix rdf: <http:> select * where { ?s ?p ?o";
    pmlp:hasLanguage :SPARQL;
    # TODO: add time created. Is this same as the UsageDateTime?
    pmlp:hasReferenceSourceUsage [
       a pmlp:SourceUsage;
       pmlp:hasSource        :myJavascript;
       pmlp:hasUsageDateTime "2010-03-09"^^xsd:dateTime;
    ];
.
:sparqlResults_67
    a pmlp:Information;
    rdfs:comment "This is what is returned to Javascript's handleResponse function";
    pmlp:hasRawString "{results: {}}";
    pmlp:hasLanguage  :SPARQL_bindings_json;
    pmlp:hasReferenceSourceUsage [
       pmlp:hasSource        :someSPARQLEndpoint;
       pmlp:hasUsageDateTime "2010-03-09"^^xsd:dateTime;
    ];
.

Second

:sparqlQuery_68
   a j:Query;
   p:hasContent [
      a p:Information;
      p:hasRawString "select * where...";
      p:hasURL       "http://rpi.edu/~lix15/new_support100inia1.sparql";
   ];
   j:hasAnswer [
      a j:NodeSet;
      j:hasConclusion [
         a p:Information;
         p:hasRawString "{version: 0.6, status: 'ok'...}";   
         p:hasLanguage :Google_Visualization_Data_Set_JSON;
         p:hasFormat   :JSON;
      ];
   ];
   j:isConsequentOf [
      a j:InferenceStep;
      j:hasInferenceEngine :TetherlessWorld_SPARQL_Proxy;
      j:hasAntecedentList (
         [ a :NodeSet; j:hasConclusion [ 
                          a :Information; 
                          p:hasRawString "service-uri=http://dbpedia.org/sparql" 
                       ]
         ]
         [ a :NodeSet; j:hasConclusion [ 
                          a :Information; 
                          p:hasRawString "query-uri=http://rpi.edu/~lix15/new_support100inia1.sparql"    
                       ] 
         ]
         [ a :NodeSet; j:hasConclusion [ 
                          a :Information; 
                          p:hasRawString "output=gvds"    
                       ] 
         ]
      );
   ];
   j:isConsequentOf [
      a j:InferenceStep;
      j:hasInferenceEngine :Saxon9_1_b;
      j:hasAntecedentList (
         [ a :NodeSet; j:hasConclusion [ a :Information; p:hasURL "http://bindings2gvds.xsl" ] ]
         [ a :NodeSet; j:hasConclusion [ a :Information; p:hasRawString "<sparql><head>..."    ] ]
      );
   ];
.
Personal tools
Navigation