# SPARQL Update format error

**URL:** <https://community.stardog.com/t/sparql-update-format-error/490>\
**Category:** Support\
**Created:** [July 28, 2017, 5:38pm UTC](https://community.stardog.com/t/sparql-update-format-error/490 "2017-07-28T17:38:49Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoechi](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zoechi/32/129_2.png) [@zoechi](https://community.stardog.com/u/zoechi)\
**Post date:** [July 28, 2017, 5:38pm UTC](https://community.stardog.com/t/sparql-update-format-error/490/1 "2017-07-28T17:38:49Z")

</div>

Hey,  
I’m just starting with Stardog.

I tried to send

`LOAD <http://qudt.org/1.1/vocab/dimensionalunit> INTO GRAPH <http://qudt.org/1.1/vocab/dimensionalunit>`

to the `http://localhost:5820/test1/update` endpoint,  
which resulted in

`{"message":"No known format matches the file: /tmp/data6682508545189935642.scr"}`

I also tried to add `?'format=RDF/XML'` to the URL, but it didn’t change anything.

Should this work?

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [July 30, 2017, 11:04pm UTC](https://community.stardog.com/t/sparql-update-format-error/490/2 "2017-07-30T23:04:12Z")

</div>

I was able to reproduce the error you’re seeing. It should work and I was able to successfully load other resources. Looks like some issue with the content type and could be because it’s returning text/xml rather than application/rdf+xml for the content type

---

<div class="post-metadata">

**Author:** ![zoechi](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zoechi/32/129_2.png) [@zoechi](https://community.stardog.com/u/zoechi)\
**Post date:** [July 31, 2017, 7:46am UTC](https://community.stardog.com/t/sparql-update-format-error/490/3 "2017-07-31T07:46:56Z")

</div>

Thanks a lot for investigating!

> No known format matches the file

The error message seems to be a bit misleading.  
It sounds like it tried several formats, but if it actually had tried `rdf+xml` it should have succeeded (I assume `rdf+xml` is a known format).

What about supporting a parameter that allows to override the format (like with a query parameter as I tried)?

---

<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:** [July 31, 2017, 12:53pm UTC](https://community.stardog.com/t/sparql-update-format-error/490/4 "2017-07-31T12:53:10Z")

</div>

Zach is correct here. Stardog uses the Content-Type of the response to determine the file format, and the only acceptable MIME types for RDF/XML are, according to our parser, application/rdf+xml and application/xml.

I will open up a ticket for us to implement some sort of workaround for this case, but in the meantime I would suggest manually downloading the RDF/XML and adding it to Stardog.

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [July 31, 2017, 1:03pm UTC](https://community.stardog.com/t/sparql-update-format-error/490/5 "2017-07-31T13:03:55Z")

</div>

I don’t think that it tries formats until it finds one that succeeds. I believe that it will try the content type first, if it’s not one that is supported it might fall back to guessing from the extension. In this case there is no extension and the file type is returning it as text/xml. With that type it could either be TRIX or RDF/XML. It doesn’t seem as though the specs have much about how it should be handled. Adding a parameter to the url would be problematic. You wouldn’t know if it should be used for dereferencing the file and stripped off or if it was actually part of the url and should be passed along. Unfortunately the endpoint isn’t providing enough information to parse the file and some guessing would be involved.

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [July 31, 2017, 1:07pm UTC](https://community.stardog.com/t/sparql-update-format-error/490/6 "2017-07-31T13:07:41Z")

</div>

…bash to the rescue

```
stardog data add --named-graph http://qudt.org/1.1/vocab/dimensionalunit mydb <(curl -s http://qudt.org/1.1/vocab/dimensionalunit)

```

I messed around a while ago with writing a custom function to allow you to make http calls. Something along the line of

`SELECT url:get(?url) where { ...}`

Where it would hash the file and return a local file: url like file://home/myhome/stardog-files/4A/B3/983ABF382

I’m not sure how good an idea it was but it was fun to play with. If anyone thinks it’s not a dumb idea I’d be happy to polish it up.

---

<div class="post-metadata">

**Author:** ![zoechi](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zoechi/32/129_2.png) [@zoechi](https://community.stardog.com/u/zoechi)\
**Post date:** [July 31, 2017, 1:14pm UTC](https://community.stardog.com/t/sparql-update-format-error/490/7 "2017-07-31T13:14:23Z")

</div>

Thanks a lot for all the support!  
I was able to upload the file using a shell command.

I still think the error message could be more helpful.  
But otherwise you can consider the case closed.

---

<div class="post-metadata">

**Author:** ![zoechi](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zoechi/32/129_2.png) [@zoechi](https://community.stardog.com/u/zoechi)\
**Post date:** [August 1, 2017, 9:58am UTC](https://community.stardog.com/t/sparql-update-format-error/490/8 "2017-08-01T09:58:36Z")

</div>

Is there any other HTTP API to upload such data (besides SPARQL-Update)?  
I try to avoid the need to reach out to the command line so I’m able to do it from a remote client application.

Otherwise I’d download it into memory, transform it and upload it using `INSERT DATA`

---

<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:** [August 1, 2017, 11:06am UTC](https://community.stardog.com/t/sparql-update-format-error/490/9 "2017-08-01T11:06:47Z")

</div>

You can POST the data over HTTP via our API: [http://docs.stardog.apiary.io/#reference/transactions/adding-data-to-a-transaction/post](http://docs.stardog.apiary.io/#reference/transactions/adding-data-to-a-transaction/post)

---

<div class="post-metadata">

**Author:** ![zoechi](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zoechi/32/129_2.png) [@zoechi](https://community.stardog.com/u/zoechi)\
**Post date:** [August 2, 2017, 6:54am UTC](https://community.stardog.com/t/sparql-update-format-error/490/10 "2017-08-02T06:54:46Z")

</div>

That’s great, exactly what I was looking for.  
I thought I read somewhere that this HTTP API was removed or is deprecated.  
I’m new to Stardog. I might have mixed something up.

---

<div class="post-metadata">

**Author:** ![zoechi](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zoechi/32/129_2.png) [@zoechi](https://community.stardog.com/u/zoechi)\
**Post date:** [August 2, 2017, 11:08am UTC](https://community.stardog.com/t/sparql-update-format-error/490/11 "2017-08-02T11:08:29Z")

</div>

This worked fine. Thanks again for the pointer.

---

<div class="post-metadata">

**Author:** ![zoechi](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zoechi/32/129_2.png) [@zoechi](https://community.stardog.com/u/zoechi)\
**Post date:** [August 2, 2017, 12:26pm UTC](https://community.stardog.com/t/sparql-update-format-error/490/12 "2017-08-02T12:26:40Z")

</div>

I can load the data into the default graph, but wasn’t yet able to load them into a named graph

```auto
curl --trace-ascii trace.txt \
     --include \
     --request POST \
     --header "Accept: text/plain" \
     --header "Content-Type: application/rdf+xml" \
     --data-binary "@data/qudt_dimensionalunit.rdf" \
     -u admin:admin \
'http://localhost:5820/test1/4a28a0d7-e106-4e78-a660-920028ac61a1/add?http://qudt.org/1.1/vocab/dimensionalunit'

```

This doesn’t seem to be the correct way to pass the graph-uri.  
Any hint what I’m doing wrong?

---

<div class="post-metadata">

**Author:** ![zoechi](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zoechi/32/129_2.png) [@zoechi](https://community.stardog.com/u/zoechi)\
**Post date:** [August 2, 2017, 12:33pm UTC](https://community.stardog.com/t/sparql-update-format-error/490/13 "2017-08-02T12:33:53Z")

</div>

```auto
'http://localhost:5820/test1/4a28a0d7-e106-4e78-a660-920028ac61a1/add?graph-uri=http://qudt.org/1.1/vocab/dimensionalunit'

```

did the trick.  
I found this quite difficult to decipher from the format used for the URL is shown in the docs.  
A concrete example without the `{}` replacements would have been very useful.

---

<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:** [August 2, 2017, 12:38pm UTC](https://community.stardog.com/t/sparql-update-format-error/490/14 "2017-08-02T12:38:50Z")

</div>

We are currently in the process of updating/redoing the apiary docs, however this is the standard way to denote query params as stated in their [Docs](https://help.apiary.io/api_101/uri-templates/#basic-usage).

For a simple load such as this, we also support the [SPARQL Graph Store Protocol](https://www.w3.org/TR/sparql11-http-rdf-update/#http-put), so instead of beginning a tx, adding the data, committing the tx, you could simply `PUT http://localhost:5820/test1?graph=http://qudt.org/1.1/vocab/dimensionalunit` with your Content-Type and data set appropriately.

---

<div class="post-metadata">

**Author:** ![zoechi](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zoechi/32/129_2.png) [@zoechi](https://community.stardog.com/u/zoechi)\
**Post date:** [August 2, 2017, 1:56pm UTC](https://community.stardog.com/t/sparql-update-format-error/490/15 "2017-08-02T13:56:29Z")

</div>

I see. Thanks a lot for all the pointers.  
It’s a lot of info to process at once at the beginning 😉

---

<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, 2017, 1:56pm UTC](https://community.stardog.com/t/sparql-update-format-error/490/16 "2017-08-16T13:56:34Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
