I was playing around with some queries I run elsewhere and came up with what struck me as an oddity. I am inserting triples as integers. When running a SELECT query and retrieving them as JSON results, I get back literals with the integer type. When I run a CONSTRUCT query and bring back the triples, the datatype on the objects are not explicitly stated. Is there an optional reason for this that I've just not run into elsewhere?

John



[john] bin/s-update --verbose --service=http://localhost:3030/stress/update  
--file=update1.sparql

update1.sparql:

prefix myjunk:<http://testing.com/triples/>
prefix xs:<http://www.w3.org/2001/XMLSchema#>

insert data {
  graph myjunk:TestIds {
    myjunk:Test_44522 myjunk:TestId "44522"^^xs:int .
    myjunk:Test_2799404 myjunk:TestId "2799404"^^xs:int .
    myjunk:Test_5566 myjunk:TestId "5566"^^xs:int .
    myjunk:Test_34892 myjunk:TestId "34892"^^xs:int .
    myjunk:Test_444 myjunk:TestId "444"^^xs:int .
    myjunk:Test_274034549 myjunk:TestId "274034549"^^xs:int .
    myjunk:Test_43589345 myjunk:TestId "43589345"^^xs:int .
  }
}



SPARQL-Updatehttp://localhost:3030/stress/update
POSThttp://localhost:3030/stress/update
  User-Agent:          SOH/Fuseki 0.0.2
  Content-Type:        application/sparql-update
204 No Content
  Date:                Wed, 27 Dec 2017 19:13:15 GMT
  Fuseki-Request-Id:   26
  Server:              Fuseki (2.3.1)

[john] bin/s-query --verbose --service=http://localhost:3030/stress/query  
--file=query2.sparql --post


query2.sparql:

prefix myjunk:<http://testing.com/triples/>
prefix xs:<http://www.w3.org/2001/XMLSchema#>

select ?s ?p ?o
where {
  graph myjunk:TestIds {
    ?s ?p ?o .
  }
}


SPARQLhttp://localhost:3030/stress/query
POSThttp://localhost:3030/stress/query
  User-Agent:          SOH/Fuseki 0.0.2
  Accept:              application/sparql-results+json , 
application/sparql-results+xml;q=0.9 , text/turtle;charset=utf-8 , 
application/n-triples;q=0.9 , application/rdf+xml;q=0.8 , 
application/ld+json;q=0.5 , */*;q=0.1
  Content-Type:        application/x-www-form-urlencoded
  Content-Length:      250
200 OK
  Date:                Wed, 27 Dec 2017 19:13:20 GMT
  Fuseki-Request-Id:   27
  Server:              Fuseki (2.3.1)
  Cache-Control:       must-revalidate,no-cache,no-store
  Pragma:              no-cache
  Content-Type:        application/sparql-results+json; charset=utf-8
  Transfer-Encoding:   chunked
{
  "head": {
    "vars": [ "s" , "p" , "o" ]
  } ,
  "results": {
    "bindings": [
      {
        "s": { "type": "uri" , "value":"http://testing.com/triples/Test_44522";  
} ,
        "p": { "type": "uri" , "value":"http://testing.com/triples/TestId";  } ,
        "o": { "datatype":"http://www.w3.org/2001/XMLSchema#integer";  , "type": "typed-literal" , 
"value": "44522" }
      } ,
      {
        "s": { "type": "uri" , 
"value":"http://testing.com/triples/Test_2799404";  } ,
        "p": { "type": "uri" , "value":"http://testing.com/triples/TestId";  } ,
        "o": { "datatype":"http://www.w3.org/2001/XMLSchema#integer";  , "type": "typed-literal" , 
"value": "2799404" }
      } ,
      {
        "s": { "type": "uri" , "value":"http://testing.com/triples/Test_5566";  
} ,
        "p": { "type": "uri" , "value":"http://testing.com/triples/TestId";  } ,
        "o": { "datatype":"http://www.w3.org/2001/XMLSchema#integer";  , "type": "typed-literal" , 
"value": "5566" }
      } ,
      {
        "s": { "type": "uri" , "value":"http://testing.com/triples/Test_34892";  
} ,
        "p": { "type": "uri" , "value":"http://testing.com/triples/TestId";  } ,
        "o": { "datatype":"http://www.w3.org/2001/XMLSchema#integer";  , "type": "typed-literal" , 
"value": "34892" }
      } ,
      {
        "s": { "type": "uri" , "value":"http://testing.com/triples/Test_444";  } 
,
        "p": { "type": "uri" , "value":"http://testing.com/triples/TestId";  } ,
        "o": { "datatype":"http://www.w3.org/2001/XMLSchema#integer";  , "type": "typed-literal" , 
"value": "444" }
      } ,
      {
        "s": { "type": "uri" , 
"value":"http://testing.com/triples/Test_274034549";  } ,
        "p": { "type": "uri" , "value":"http://testing.com/triples/TestId";  } ,
        "o": { "datatype":"http://www.w3.org/2001/XMLSchema#integer";  , "type": "typed-literal" , 
"value": "274034549" }
      } ,
      {
        "s": { "type": "uri" , 
"value":"http://testing.com/triples/Test_43589345";  } ,
        "p": { "type": "uri" , "value":"http://testing.com/triples/TestId";  } ,
        "o": { "datatype":"http://www.w3.org/2001/XMLSchema#integer";  , "type": "typed-literal" , 
"value": "43589345" }
      }
    ]
  }
}
[john] bin/s-query --verbose --service=http://localhost:3030/stress/query  
--file=query3.sparql --post

query3.sparql:

prefix myjunk:<http://testing.com/triples/>
prefix xs:<http://www.w3.org/2001/XMLSchema#>

construct {
  ?s myjunk:TestId ?o .
}
where {
  graph myjunk:TestIds {
    ?s myjunk:TestId ?o .
  }
}


SPARQLhttp://localhost:3030/stress/query
POSThttp://localhost:3030/stress/query
  User-Agent:          SOH/Fuseki 0.0.2
  Accept:              application/sparql-results+json , 
application/sparql-results+xml;q=0.9 , text/turtle;charset=utf-8 , 
application/n-triples;q=0.9 , application/rdf+xml;q=0.8 , 
application/ld+json;q=0.5 , */*;q=0.1
  Content-Type:        application/x-www-form-urlencoded
  Content-Length:      290
200 OK
  Date:                Wed, 27 Dec 2017 19:13:26 GMT
  Fuseki-Request-Id:   28
  Server:              Fuseki (2.3.1)
  Cache-Control:       must-revalidate,no-cache,no-store
  Pragma:              no-cache
  Content-Type:        text/turtle; charset=utf-8
  Transfer-Encoding:   chunked
<http://testing.com/triples/Test_274034549>
        <http://testing.com/triples/TestId>
                274034549 .

<http://testing.com/triples/Test_444>
        <http://testing.com/triples/TestId>
                444 .

<http://testing.com/triples/Test_44522>
        <http://testing.com/triples/TestId>
                44522 .

<http://testing.com/triples/Test_2799404>
        <http://testing.com/triples/TestId>
                2799404 .

<http://testing.com/triples/Test_5566>
        <http://testing.com/triples/TestId>
                5566 .

<http://testing.com/triples/Test_34892>
        <http://testing.com/triples/TestId>
                34892 .

<http://testing.com/triples/Test_43589345>
        <http://testing.com/triples/TestId>
                43589345 .
[john]

Reply via email to