Coder Social home page Coder Social logo

Comments (3)

rjrudin avatar rjrudin commented on June 11, 2024

The syntax error is correct - "12." is interpreted as a symbol, and the syntax error thus occurs because the two lines in your statement run together.

This section from the MarkLogic Semantics docs shows a number of examples for constructing query clauses correctly. I like this Apache Jena tutorial as well for when I need to remember basic SPARQL syntax. Those should help you with constructing your desired SPARQL queries.

from java-client-api.

Cynthia-77 avatar Cynthia-77 commented on June 11, 2024

The syntax error is correct - "12." is interpreted as a symbol, and the syntax error thus occurs because the two lines in your statement run together.

This section from the MarkLogic Semantics docs shows a number of examples for constructing query clauses correctly. I like this Apache Jena tutorial as well for when I need to remember basic SPARQL syntax. Those should help you with constructing your desired SPARQL queries.

If explicitly declaring the data type of integer "12", the SparQL query can be executed correctly in MarkLogic. Like the following:

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT *
WHERE { 
        ?var1 ?var2 "12"^^xsd:integer.
        <http://JohnSmith> <http://livesIn> ?var3.
      }

Do all integers in a SparQL query need to explicitly declare their data type to execute in MarkLogic?

But the SparQL documentation states that "integers can be written directly (without quotation marks and an explicit datatype IRI) and are interpreted as typed literals of datatype xsd:integer".

And this query can be executed correctly in Apache Jena.

SELECT *
WHERE { 
        ?var1 ?var2 12.
        <http://JohnSmith> <http://livesIn> ?var3.
      }

Does MarkLogic consider to support this feature in the future?

from java-client-api.

jpcs avatar jpcs commented on June 11, 2024

The grammar production for a decimal number changed between SPARQL 1.0 and SPARQL 1.1:

https://www.w3.org/TR/rdf-sparql-query/#rDECIMAL
https://www.w3.org/TR/sparql11-query/#rDECIMAL

It looks like MarkLogic is still using the SPARQL 1.0 definition of a decimal, which means that the "12." in your query is treated as a decimal literal, rather than "12" followed by ".".

from java-client-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.