• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SPARQL query language

 
Ranch Hand
Posts: 686
Mac
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The book references SPARQL query language.That is a new term to me? What is that? How it is useful in functional programming
 
Author
Posts: 31
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SPARQL is the language you can use to query Wikidata. See: https://query.wikidata.org/

It's used in the last part of the book in the real-world functional application we are developing. This application is querying Wikidata for locations and movies. We are showing how this kind of side-effectful program can be written using just immutable values and pure functions.

After reading and understanding these techniques, a reader can reuse this knowledge to write programs that have SQL queries or Web Service HTTP requests. So, again, SPARQL is just an example. I chose it because chances are Wikidata will stay with us for a loooong loooong time so the book will be up-to-date, hopefully, that long as well.
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would you regard a search of a conventional database as a function? If you do the same search twice you should get the same result if nothing else has changed.
 
Saloon Keeper
Posts: 7585
176
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

SPARQL is the language you can use to query Wikidata. See: https://query.wikidata.org/


While querying Wikidata is cool,  SparQL can do more than that. It can query any data for which an RDF description is available, which might be anything held in a triple store.
 
Michał Płachta
Author
Posts: 31
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Would you regard a search of a conventional database as a function? If you do the same search twice you should get the same result if nothing else has changed.



You may treat it as a function but it's definitely not a pure function, because there are side effects involved (you are querying over a network, the DB state can change, the host computer may change, and so on). That's why we use the IO type for such functionalities. The IO type is an immutable value that describes side-effectful things. We introduce IO later in the book (chapter 8) so there are some foundational things you need to learn to grasp it but it's very powerful and helps with the design a lot.
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. I shall ask about foundational things in a new post.
 
reply
    Bookmark Topic Watch Topic
  • New Topic