PUTメソッドで新しいオブジェクトを作成しようとしていて、自分のプレフィックスの一部にSPARQLクエリを追加しようとしています。しかし、オブジェクトは接頭辞を付け加えずに作成されています。 POSTとPATCHで動作します。 SPARQLがPUTメソッドで使用し、ユーザー定義の接頭辞を使用して追加する別の方法はなぜですか?SPARQL INSERTはPUTメソッドでは機能しません。どうして?
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX indexing: <http://fedora.info/definitions/v4/indexing#>
DELETE { }
INSERT {
<> indexing:hasIndexingTransformation "default";
rdf:type indexing:Indexable;
dc:title "title3";
dc:identifier "test:10";
}
WHERE { }
私はinsert
句で指定されたすべての上記の値が全く追加されていませんでした何を言っています。
EDIT1:
url = 'http://example.com/rest/object1'
payload = """
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX indexing: <http://fedora.info/definitions/v4/indexing#>
PREFIX custom: <http://customnamespaces/custom#/>
DELETE { }
INSERT {
<> indexing:hasIndexingTransformation "default";
rdf:type indexing:Indexable;
dc:title "title1";
custom:objState "Active";
custom:ownerId "Owner1";
dc:identifier "object1";
}
WHERE { }
"""
headers = {
'content-type': "application/sparql-update",
'cache-control': "no-cache"
}
response = requests.request("PUT", url, data=payload, headers=headers, auth=('username','password'))
他の方法がない場合は、私は2つのステップでそれを実行する必要があります:1.オブジェクトを作成し、完全なURIを使用して接頭辞
)を使用して1) PUTを使ってオブジェクトを更新する –
あなたは 'POST'と' PUT'をどのように呼び出すのかをもう少し明示できますか? – scotthenninger
こんにちはスコット、私は質問にそれを追加しました。 –