Hub
Pricing About
  • Software
  • Blog
  • Forum
  • Events
  • Documentation
  • About KNIME
  • KNIME Community Hub
  • Nodes
  • SPARQL Query
NodeNode / Source

SPARQL Query

KNIME Labs Semantic Web/Linked Data Read/Write Streamable
Drag & drop
Like
Copy short link

This node can be connected with Semantic Web endpoints to perform SELECT queries. Please note that based on the connected endpoint, same data and same queries may lead to different results. For instance, the following SELECT query

SELECT * WHERE {?s ?p ?o}
queries all triples in the default graph, if an In-Memory Endpoint is connected. A Virtuoso database (by Virtuoso Endpoint ) will reutrn all triples present in the database.
To query specific graphs, e.g. graphs named a and b, the query with an In-Memory Endpoint is
SELECT * WHERE { { GRAPH <a> { ?s ?p ?o } } UNION { GRAPH <b> { ?s ?p ?o } } }
But with a Virtuoso database it is
SELECT * FROM NAMED <a> FROM NAMED <b> WHERE { GRAPH ?graph { ?s ?p ?o } }


The N-Triples format for the query result is necessary to be kept if you want to insert the triples in an endstore. This is especially imporant for (typed) literals. If the N-Triples format is not preserved type information will get lost (a String representation of the literal is returned). For URIs the angled brackets are not preserved, which are necessary for insertion. Here is an example showing triples with and without format preservation:
Preserve sub pred object
Yes <http://expl.org/expl> <http://expl.org/integer> 4
No http://expl.org/expl http://expl.org/integer 4
Yes <http://expl.org/expl> <http://expl.org/string> "4"
No http://expl.org/expl http://expl.org/string 4
Yes <http://expl.org/expl> <http://expl.org/string> "sometstring"@en
No http://expl.org/expl http://expl.org/string sometstring
Yes <http://expl.org/expl> <http://expl.org/own> "123k"^^<http://expl.org/owntype>
No http://expl.org/expl http://expl.org/own 123k


Functionality is provided using the Apache Jena Framework

Node details

Input ports
  1. Type: Semantic Web Connection
    Semantic Web Connection
    Semantic Web connection
Output ports
  1. Type: Table
    Query Result Table
    Buffered Data Table containing query results

Extension

The SPARQL Query node is part of this extension:

  1. Go to item

Related workflows & nodes

  1. Go to item
  2. Go to item
  3. Go to item
  1. Go to item
  2. Go to item
  3. Go to item
  4. Go to item
  5. Go to item
  6. Go to item

KNIME
Open for Innovation

KNIME AG
Talacker 50
8001 Zurich, Switzerland
  • Software
  • Getting started
  • Documentation
  • E-Learning course
  • Solutions
  • KNIME Hub
  • KNIME Forum
  • Blog
  • Events
  • Partner
  • Developers
  • KNIME Home
  • KNIME Open Source Story
  • Careers
  • Contact us
Download KNIME Analytics Platform Read more on KNIME Business Hub
© 2023 KNIME AG. All rights reserved.
  • Trademarks
  • Imprint
  • Privacy
  • Terms & Conditions
  • Credits