Reputation: 21
I created an ontology in PROTEGE with the following IRI:
http://www.marketplace.org/CarrierBlueprint#
and prefix i gave it mp
Now i uploaded this ontology in Fuseki server and trying to run update statements.
In this ontology there is a class called CarrierProfile, so I want to create a new carrier profile using INSERT
statement
(1) I tried this
INSERT DATA {
GRAPH <http://www.marketplace.org/CarrierBlueprint#>
{
mp:CarrierProfile3 rdf:type mp:CarrierProfile.
}
}
-- fuseki server shows UPDATE SUCCESS
and when I query back I dont get a new carrier profile with name CarrierProfile3
BUT
(2) when i use this
INSERT DATA {
mp:CarrierProfile3 rdf:type mp:CarrierProfile.
}
It is also successful and when I query I get this time a new carrier profile with name CarrierProfile3
I don't understand what I am doing wrong in code 1. Am I not mentioning the graph properly?
Upvotes: 2
Views: 411
Reputation: 28646
Creating an ontology with a given IRI does not necessarily give it that URI when you upload it to a store. Each store has its own way of specifying into which graph new data is loaded, in the case of Fuseki when you uploaded your ontology file it almost certainly went into the default graph which is unnamed.
With Fuseki you can upload to a specific named graph by entering the desired name in the upload forms graph field.
You can see all your data including what graph it is in using the following query:
SELECT *
WHERE
{
{ ?s ?p ?o } UNION { GRAPH ?g { ?s ?p ?o } }
}
Now as far as your two updates go the reason they both succeed is that they both insert valid data, the problem is that update 1 inserts it specifically into the named graph whereas update 2 inserts into the unnamed default graph. You haven't shown the specific query that you use to test if your update "worked" but I assume it is something like the following:
SELECT *
WHERE
{
?x a mp:CarrierProfile .
}
The problem here is that your query only queries the unnamed default graph so after the first update you won't see any changes in that graph because you updated a specific named graph. Whereas with the second update you updated the default graph so the query does see the new data.
You can rewrite your query to access a specific named graph in a couple of ways. Firstly you can use the GRAPH
clause as in your first update e.g.
SELECT *
WHERE
{
GRAPH <http://www.marketplace.org/CarrierBlueprint#>
{
?x a mp:CarrierProfile .
}
}
Or you can use the FROM
clause to make a specific named graph the default graph for your query e.g.
SELECT *
FROM <http://www.marketplace.org/CarrierBlueprint#>
WHERE
{
?x a mp:CarrierProfile .
}
Upvotes: 2