# RDF @base for relative IRIs

**URL:** <https://community.stardog.com/t/rdf-base-for-relative-iris/661>\
**Category:** Bug\
**Created:** [October 28, 2017, 7:10pm UTC](https://community.stardog.com/t/rdf-base-for-relative-iris/661 "2017-10-28T19:10:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![arwesterinen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/arwesterinen/32/40_2.png) [@arwesterinen](https://community.stardog.com/u/arwesterinen)\
**Post date:** [October 28, 2017, 7:10pm UTC](https://community.stardog.com/t/rdf-base-for-relative-iris/661/1 "2017-10-28T19:10:39Z")

</div>

When I add a Turtle RDF file to a database, and the RDF file uses an @base definition, relative IRIs are not correctly resolved. They resolve with the base, [http://api.stardog.com](http://api.stardog.com).

Andrea

---

<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:** [October 28, 2017, 7:52pm UTC](https://community.stardog.com/t/rdf-base-for-relative-iris/661/2 "2017-10-28T19:52:42Z")

</div>

A quick test shows it working as expected. I have a guess what might be happening. What version of Stardog are you using and can you post a copy of the file or one that reproduces the problem?

---

<div class="post-metadata">

**Author:** ![arwesterinen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/arwesterinen/32/40_2.png) [@arwesterinen](https://community.stardog.com/u/arwesterinen)\
**Post date:** [October 29, 2017, 12:30am UTC](https://community.stardog.com/t/rdf-base-for-relative-iris/661/3 "2017-10-29T00:30:12Z")

</div>

I am using 5.0.4 and the rdf is:

@prefix rdf: [http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#) .  
@prefix rdfs: [http://www.w3.org/2000/01/rdf-schema#](http://www.w3.org/2000/01/rdf-schema#) .  
@prefix xsd: [http://www.w3.org/2001/XMLSchema#](http://www.w3.org/2001/XMLSchema#).  
@base [http://example.org/schemas/vehicles#](http://example.org/schemas/vehicles#) .  
@prefix ex: [http://example.org/schemas/vehicles#](http://example.org/schemas/vehicles#) .

:MotorVehicle a rdfs:Class.

:PassengerVehicle a rdfs:Class;  
rdfs:subClassOf :MotorVehicle.

:Truck a rdfs:Class;  
rdfs:subClassOf :MotorVehicle.

:Van a rdfs:Class;  
rdfs:subClassOf :MotorVehicle.

:MiniVan a rdfs:Class;  
rdfs:subClassOf :Van;  
rdfs:subClassOf :PassengerVehicle .

:Person a rdfs:Class.

xsd:integer a rdfs:Datatype.

:registeredTo a rdf:Property;  
rdfs:domain :MotorVehicle;  
rdfs:range :Person.

:rearSeatLegRoom a rdf:Property;  
rdfs:domain :MotorVehicle;  
rdfs:range xsd:integer.

:driver a rdf:Property;  
rdfs:domain :MotorVehicle.

:primaryDriver a rdf:Property;  
rdfs:subPropertyOf :driver.

:johnSmithsCar a ex:PassengerVehicle;  
ex:registeredTo [http://www.example.org/staffid/85740](http://www.example.org/staffid/85740);  
ex:rearSeatLegRoom "127"^^xsd:integer;  
ex:primaryDriver [http://www.example.org/staffid/85740](http://www.example.org/staffid/85740).

Andrea Westerinen  
T: 425.891.8407  
[arwesterinen@gmail.com](mailto:arwesterinen@gmail.com) or [andreaw@ninepts.com](mailto:andreaw@ninepts.com)  
[organizingknowledge.blogspot.com](http://organizingknowledge.blogspot.com)

---

<div class="post-metadata">

**Author:** ![evren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/evren/32/1515_2.png) [@evren](https://community.stardog.com/u/evren)\
**Post date:** [October 29, 2017, 12:38am UTC](https://community.stardog.com/t/rdf-base-for-relative-iris/661/4 "2017-10-29T00:38:47Z")

</div>

Hi Andrea,

You are using prefixed names with the default namespace which is different than relative IRIs using the base IRI. You want to define a default namespace like:

```auto
@prefix : <http://example.org/schemas/vehicles#> .

```

Best,  
Evren

---

<div class="post-metadata">

**Author:** ![arwesterinen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/arwesterinen/32/40_2.png) [@arwesterinen](https://community.stardog.com/u/arwesterinen)\
**Post date:** [October 31, 2017, 2:43am UTC](https://community.stardog.com/t/rdf-base-for-relative-iris/661/5 "2017-10-31T02:43:42Z")

</div>

Evren, Thanks for the clarification. I took a file submitted by a user and  
did not validate the syntax (I never used @base before in straight RDF).

I see that the references should be written as \<#xxx\> and not :xxx. When I  
fixed the input, everything worked as expected.

Andrea Westerinen  
T: 425.891.8407  
[arwesterinen@gmail.com](mailto:arwesterinen@gmail.com) or [andreaw@ninepts.com](mailto:andreaw@ninepts.com)  
[organizingknowledge.blogspot.com](http://organizingknowledge.blogspot.com)
