yaz/commit
MINOR
author | Michiel Hildebrand |
---|---|
Tue Dec 20 13:28:08 2011 +0100 | |
committer | Michiel Hildebrand |
Tue Dec 20 13:28:08 2011 +0100 | |
commit | 5176d18f27db11cda169949b13a8fe4ce9051b96 |
tree | 20946ba755da45ef262bdf5068ba1c0cfdd7e4ca |
parent | 9f82c7a4ea2b84ac1e80e57f9bc33ec40649be70 |
Diff style: patch stat
diff --git a/api/ugm_ingest.pl b/api/ugm_ingest.pl index e5abad4..8810755 100644 --- a/api/ugm_ingest.pl +++ b/api/ugm_ingest.pl @@ -39,7 +39,8 @@ http_api_ugm_ingest(Request) :- [ videoURL(VideoURL, [description('URL of the video')]), videoId(VideoId, - [description('Identifier of the video')]), + [optional(true), + description('Identifier of the video')]), videoTitle(Title, [default(''), description('Title of the video')]), @@ -47,14 +48,13 @@ http_api_ugm_ingest(Request) :- [default(0), description('Duration of the video in seconds')]), videoDescription(Desc, - [default(''), + [optional(true), description('Description of the video')]), slug(Slug, - [default(''), + [optional(true), description('Slug to identify the video')]), streamURL(StreamURL, - [optional(true), - description('URL of the video stream')]), + [description('URL of the video stream')]), entries(Entries, [json_tag_entries, description('JSON object with the annotations')]) @@ -73,7 +73,7 @@ http_api_ugm_ingest(Request) :- import_entries(Entries, VideoURL), debug(ugm_ingest, 'added ~w tag entries', [EntryCount]) )), - reply_json(json([videoId=VideoId,entryCount=EntryCount])). + reply_json(json([videoURL=VideoURL,entryCount=EntryCount])). http:convert_parameter(json_tag_entries, Atom, Term) :- atom_json_term(Atom, JSON, []), @@ -96,15 +96,23 @@ http:convert_parameter(json_tag_entries, Atom, Term) :- import_video(URL, Id, Stream, Title, Desc, Duration0, Slug) :- get_time(Now), rdf_atom_object(Duration0, Duration), - rdf_assert(URL, dc:id, literal(Id), URL), - rdf_assert(URL, rdf:type, pprime:'Video', URL), - rdf_assert(URL, pprime:source, Stream, URL), - rdf_assert(URL, dc:title, literal(Title), URL), - rdf_assert(URL, dc:description, literal(Desc), URL), - rdf_assert(URL, pprime:duration, literal(Duration), URL), - rdf_assert(URL, pprime:slug, literal(Slug), URL), - rdf_assert(URL, pprime:ingestedAt, literal(Now), URL). - + rdf_cond_assert(URL, dc:id, literal(Id), URL), + rdf_cond_assert(URL, rdf:type, pprime:'Video', URL), + rdf_cond_assert(URL, pprime:source, Stream, URL), + rdf_cond_assert(URL, dc:title, literal(Title), URL), + rdf_cond_assert(URL, dc:description, literal(Desc), URL), + rdf_cond_assert(URL, pprime:duration, literal(Duration), URL), + rdf_cond_assert(URL, pprime:slug, literal(Slug), URL), + rdf_cond_assert(URL, pprime:ingestedAt, literal(Now), URL). + +:- rdf_meta + rdf_cond_assert(r,r,o,+). + +rdf_cond_assert(S,P,O,G) :- + ground(O), + !, + rdf_assert(S,P,O,G). +rdf_cond_assert(_,_,_,_). %% import_entries(+TagEntryList, +VideoId) %