Hub
  • Software
  • Blog
  • Forum
  • Events
  • Documentation
  • About KNIME
  • KNIME 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
    Insert SPARQL triples to an endpoint
    Semantic web Sparql Rdf
    +2
    This workflow demonstrates how to insert Semantic Web triples to an endpoint directly fro…
    knime > Examples > 08_Other_Analytics_Types > 06_Semantic_Web > 04_SPARQL_INSERT_from_file
  2. Go to item
    Insert triples into an In-Memory Endpoint
    Semantic web Sparql Rdf
    This workflow demonstrates how to insert triples from a table to an In-Memory Endpoint us…
    knime > Examples > 08_Other_Analytics_Types > 06_Semantic_Web > 03_SPARQL_INSERT_Query_from_table
  3. Go to item
    Large queries on a public endpoint
    Semantic web Sparql Rdf
    Public endpoints often have a limited return (say 10000 triples) to overcome this and do …
    knime > Examples > 08_Other_Analytics_Types > 06_Semantic_Web > 09_Doing_a_large_Query_on_a_public_endpoint
  4. Go to item
    SPARQL Queries and Named Graphs
    Semantic web Sparql Rdf
    This workflow demonstrates how to insert semantic web triples to named graphs and shows t…
    knime > Examples > 08_Other_Analytics_Types > 06_Semantic_Web > 05_SPARQL_Queries_and_named_graphs
  5. Go to item
    SPARQL SELECT Query from different endpoints
    Semantic web Sparql Rdf
    The workflow demonstates how to perform a SELECT query on different endpoints. This can e…
    knime > Examples > 08_Other_Analytics_Types > 06_Semantic_Web > 02_SPARQL_SELECT_Query_from_different_endpoints
  6. Go to item
    SPARQL DELETE Query
    Semantic web Sparql Rdf
    This workflow demonstrates how to Update triples stored in an endpoint. Pay attention to …
    knime > Examples > 08_Other_Analytics_Types > 06_Semantic_Web > 07_SPARQL_DELETE_Query
  7. Go to item
    SPARQL SELECT Query from different endpoints
    Semantic web Sparql Rdf
    The workflow demonstates how to perform a SELECT query on different endpoints. This can e…
    clrh > Public > 02_SPARQL_SELECT_Query_from_different_endpoints
  8. Go to item
    Delete data using the SPARQL Executor node
    Sparql Semantic web .ttl
    +2
    This workflow demonstrates how to use the SPARQL Executor node. The Exector node allows t…
    knime > Examples > 08_Other_Analytics_Types > 06_Semantic_Web > 08_SPARQL_Executor
  9. Go to item
    Update triples stored in an endpoint
    Semantic web Sparql Rdf
    This workflow demonstrates how to update triples stored in an endpoint. Please pay attent…
    knime > Examples > 08_Other_Analytics_Types > 06_Semantic_Web > 06_SPARQL_UPDATE_Query
  10. Go to item
    Semantic Web Analysis Accessing DBpedia
    Semantic web Dbpedia Sparql
    +1
    This workflow implements a DBpedia query and returns the sorted number of hours of sun in…
    knime > Examples > 08_Other_Analytics_Types > 06_Semantic_Web > 11_Semantic_Web_Analysis_Accessing_DBpedia
  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
Hardturmstrasse 66
8005 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 Server
© 2022 KNIME AG. All rights reserved.
  • Trademarks
  • Imprint
  • Privacy
  • Terms & Conditions
  • Credits