# Query Protocol Issue

**URL:** <https://community.stardog.com/t/query-protocol-issue/5207>\
**Category:** Support\
**Created:** [December 19, 2024, 1:41pm UTC](https://community.stardog.com/t/query-protocol-issue/5207 "2024-12-19T13:41:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/rahel/32/1712_2.png) [@Rahel](https://community.stardog.com/u/Rahel)\
**Post date:** [December 19, 2024, 1:41pm UTC](https://community.stardog.com/t/query-protocol-issue/5207/1 "2024-12-19T13:41:16Z")

</div>

Hi Stardog Community,

I’m encountering an issue when querying a Stardog SPARQL endpoint and would appreciate your insights or suggestions. Below are the details:

Endpoint:  
`https://sd-d8db509a.stardog.cloud:5820/JTH-Product-Data`

Problem Description

While performing SPARQL queries from different clients and environments, I noticed inconsistent behavior regarding response formats:

1. Using the SERVICE keyword in GraphDB:

```auto
SELECT * WHERE {  
    SERVICE <https://sd-d8db509a.stardog.cloud:5820/JTH-Product-Data> {  
        <http://example.org/fagerhult_notor_product_data#7320046635763> ?property ?value .  
    }  
}

```

Result:  
`500: Error Query evaluation error: Unsupported Media Type`

1. Using dotNetRDF's SparqlRemoteEndpoint.QueryWithResultSet method:

```auto
SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(new Uri("https://sd-d8db509a.stardog.cloud:5820/JTH-Product-Data"));  
endpoint.Credentials = new System.Net.NetworkCredential(" **user**", " **pwd**");  
SparqlResultSet results = endpoint.QueryWithResultSet("SELECT ?property ?value WHERE { <http://example.org/fagerhult_notor_product_data#7320046635763> ?property ?value }");

```

Result:  
`Exception: "Unable to Parse a SPARQL Result Set from the provided XML since the Document Element is not a `` element!"`

1. Using dotNetRDF's SparqlRemoteEndpoint.QueryRaw method:  
Observation:  
The raw HTTP response has a `Content-Type` header set to `text/turtle`.

I also tried setting the `Accept` header explicitly to `application/sparql-results+json`, but the response format didn’t change and remained `text/turtle`.

Working Solution

The only method that worked was using the `StardogConnector` class from dotNetRDF:

```auto
StardogConnector connector = new StardogConnector("https://sd-d8db509a.stardog.cloud:5820/JTH-Product-Data", " **user**", " **pwd**");  
SparqlResultSet results = connector.Query("SELECT ?property ?value WHERE { <http://example.org/fagerhult_notor_product_data#7320046635763> ?property ?value }");

```

Key Question:

According to the [SPARQL 1.1 Protocol](https://www.w3.org/TR/sparql11-protocol/), the specified response formats for SPARQL queries should include XML, JSON, and CSV/TSV.

Why is Stardog returning `text/turtle` instead of one of the standard formats?

Is there a way to enforce the response format (e.g., JSON or XML) when querying the endpoint?

Any guidance or suggestions would be greatly appreciated!

Thanks in advance!

Best regards,  
Rahel

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [December 19, 2024, 7:46pm UTC](https://community.stardog.com/t/query-protocol-issue/5207/2 "2024-12-19T19:46:23Z")

</div>

Hi,

That is indeed odd behavior, especially since `text/turtle` isn't even a valid response type for a SELECT query. Do either of the first two methods work if you add `/query` to the end of the URL?

Regardless, could you share an example of the `text/turtle` response that you're getting? My instance is defaulting to `application/sparql-results+xml`

---

<div class="post-metadata">

**Author:** ![Lars\_Wikstrom](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/lars_wikstrom/32/2229_2.png) [@Lars\_Wikstrom](https://community.stardog.com/u/Lars_Wikstrom)\
**Post date:** [December 20, 2024, 3:44pm UTC](https://community.stardog.com/t/query-protocol-issue/5207/3 "2024-12-20T15:44:05Z")

</div>

[output.ttl](https://community.stardog.com/uploads/short-url/7iSMUWelTnpFyJ2ZIhAUBGLZctL.ttl) (375.3 KB)  
Thank you for your response. Attached is the stream returned. Very strange?  
The query is "SELECT ?property ?value WHERE {[http://example.org/fagerhult\_notor\_product\_data#7320046635763](http://example.org/fagerhult_notor_product_data#7320046635763) ?property ?value }"

And the actual request as encoded by dotNetRDF:  
"[https://sd-d8db509a.stardog.cloud:5820/JTH-Product-Data?query=SELECT+%3Fproperty+%3Fvalue+WHERE+{\<http%3A%2F%2Fexample.org%2Ffagerhult\_notor\_product\_data%237320046635763\>+%3Fproperty+%3Fvalue+}](https://sd-d8db509a.stardog.cloud:5820/JTH-Product-Data?query=SELECT+%3fproperty+%3fvalue+WHERE+%7b%3chttp%3a%2f%2fexample.org%2ffagerhult_notor_product_data%237320046635763%3e+%3fproperty+%3fvalue+%7d)"

---

<div class="post-metadata">

**Author:** ![Rahel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/rahel/32/1712_2.png) [@Rahel](https://community.stardog.com/u/Rahel)\
**Post date:** [January 9, 2025, 10:14am UTC](https://community.stardog.com/t/query-protocol-issue/5207/4 "2025-01-09T10:14:17Z")

</div>

Hi,  
Thank you for your response. Could you kindly review what @Lars_Wikstrom has written? We are working on the same project and would greatly appreciate your support.

Kind regards,  
Rahel

---

<div class="post-metadata">

**Author:** ![Lars\_Heling](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/lars_heling/32/1657_2.png) [@Lars\_Heling](https://community.stardog.com/u/Lars_Heling)\
**Post date:** [January 9, 2025, 10:16am UTC](https://community.stardog.com/t/query-protocol-issue/5207/5 "2025-01-09T10:16:46Z")

</div>

> [@Lars\_Wikstrom](#):
>
> [https://sd-d8db509a.stardog.cloud:5820/JTH-Product-Data?query=SELECT+%3Fproperty+%3Fvalue+WHERE+{\<http%3A%2F%2Fexample.org%2Ffagerhult\_notor\_product\_data%237320046635763\>+%3Fproperty+%3Fvalue+}](https://sd-d8db509a.stardog.cloud:5820/JTH-Product-Data?query=SELECT+%3fproperty+%3fvalue+WHERE+%7b%3chttp%3a%2f%2fexample.org%2ffagerhult_notor_product_data%237320046635763%3e+%3fproperty+%3fvalue+%7d)"

As suggest by @Stephen, make sure to add the `/query` to the endpoint URL.  
That is, should be something like:

`https://sd-d8db509a.stardog.cloud:5820/JTH-Product-Data/query?query=...`

Best regards  
Lars

---

<div class="post-metadata">

**Author:** ![Lars\_Wikstrom](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/lars_wikstrom/32/2229_2.png) [@Lars\_Wikstrom](https://community.stardog.com/u/Lars_Wikstrom)\
**Post date:** [January 9, 2025, 12:44pm UTC](https://community.stardog.com/t/query-protocol-issue/5207/6 "2025-01-09T12:44:40Z")

</div>

Thank you! Now it works fine with the standard sparql calls from dotNetRDF. I still get an error _"Query evaluation error: org.eclipse.rdf4j.query.QueryEvaluationException: org.eclipse.rdf4j.query.resultio.QueryResultParseException: File does not contain a binary RDF table result"_ when trying to query as SERVICE from GraphDB, but I guess that I will have to take that thing with those guys.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [August 16, 2025, 12:33pm UTC](https://community.stardog.com/t/query-protocol-issue/5207/7 "2025-08-16T12:33:11Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [April 11, 2026, 4:02pm UTC](https://community.stardog.com/t/query-protocol-issue/5207/8 "2026-04-11T16:02:51Z")

</div>


