RDF @base for relative IRIs

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.

Andrea

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?

I am using 5.0.4 and the rdf is:

@prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# .
@prefix rdfs: http://www.w3.org/2000/01/rdf-schema# .
@prefix xsd: http://www.w3.org/2001/XMLSchema#.
@base http://example.org/schemas/vehicles# .
@prefix ex: 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;
ex:rearSeatLegRoom "127"^^xsd:integer;
ex:primaryDriver http://www.example.org/staffid/85740.

Andrea Westerinen
T: 425.891.8407
arwesterinen@gmail.com or andreaw@ninepts.com
organizingknowledge.blogspot.com

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:

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

Best,
Evren

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 or andreaw@ninepts.com
organizingknowledge.blogspot.com