[tracker-miners/sam/extract-validation: 1/3] tracker-extract-desktop: Change how desktop 'Link' files are stored
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/sam/extract-validation: 1/3] tracker-extract-desktop: Change how desktop 'Link' files are stored
- Date: Fri, 9 Oct 2020 18:47:40 +0000 (UTC)
commit e6f99f4afd8a70654c7a71a1d430def4a2ee3efb
Author: Sam Thursfield <sam afuera me uk>
Date: Fri Oct 9 19:35:42 2020 +0200
tracker-extract-desktop: Change how desktop 'Link' files are stored
While this is an API break, the API was added recently and I suspect
it's not used yet.
The old representation was a problem because the isStoredAs attribute,
which we use to relate files with their contents, was being used to
relate the bookmark to the website.
Old output:
INSERT DATA {
<urn:link:https:%2F%2Fen.wikipedia.org%2Fwiki%2FTracker_(search_software)> a nie:DataObject ,
nfo:Website , nfo:FileDataObject ;
nie:url "https://en.wikipedia.org/wiki/Tracker_(search_software)" .
_:1 nie:title "Wikipedia Tracker" ;
nie:isStoredAs <urn:link:https:%2F%2Fen.wikipedia.org%2Fwiki%2FTracker_(search_software)> .
};
New output:
INSERT DATA {
<file:///home/sam/src/tracker-miners/tests/functional-tests/test-extraction-data/desktop/link-wikipedia-tracker.desktop>
a nfo:FileDataObject .
<https://en.wikipedia.org/wiki/Tracker_(search_software)> a nie:DataObject , nie:Website ;
nie:url "https://en.wikipedia.org/wiki/Tracker_(search_software)" .
_:1 a nfo:Bookmark ;
nie:isStoredAs
<file:///home/sam/src/tracker-miners/tests/functional-tests/test-extraction-data/desktop/link-wikipedia-tracker.desktop>
;
nie:title "Wikipedia Tracker" ;
nie:bookmarks <https://en.wikipedia.org/wiki/Tracker_(search_software)> .
};
See https://gitlab.gnome.org/GNOME/tracker-miners/-/merge_requests/181
for original MR.
src/tracker-extract/tracker-extract-desktop.c | 12 ++++--------
.../desktop/link-wikipedia-tracker.expected.json | 4 ++--
2 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-desktop.c b/src/tracker-extract/tracker-extract-desktop.c
index 887c01755..a042f96b5 100644
--- a/src/tracker-extract/tracker-extract-desktop.c
+++ b/src/tracker-extract/tracker-extract-desktop.c
@@ -169,20 +169,16 @@ process_desktop_file (TrackerResource *resource,
if (link_url) {
TrackerResource *website_resource;
- gchar *link_uri;
- g_strstrip (link_url);
- link_uri = tracker_sparql_escape_uri_printf (LINK_URN_PREFIX "%s", link_url);
-
-
- website_resource = tracker_resource_new (link_uri);
+ website_resource = tracker_resource_new (link_url);
tracker_resource_add_uri (website_resource, "rdf:type", "nie:DataObject");
tracker_resource_add_uri (website_resource, "rdf:type", "nfo:Website");
tracker_resource_set_string (website_resource, "nie:url", link_url);
- tracker_resource_set_take_relation (resource, "nie:isStoredAs", website_resource);
+
+ tracker_resource_add_uri (resource, "rdf:type", "nfo:Bookmark");
+ tracker_resource_set_take_relation (resource, "nfo:bookmarks", website_resource);
g_free (link_url);
- g_free (link_uri);
} else {
/* a Link desktop entry must have an URL */
gchar *uri;
diff --git a/tests/functional-tests/test-extraction-data/desktop/link-wikipedia-tracker.expected.json
b/tests/functional-tests/test-extraction-data/desktop/link-wikipedia-tracker.expected.json
index 929e975a4..0931e4354 100644
--- a/tests/functional-tests/test-extraction-data/desktop/link-wikipedia-tracker.expected.json
+++ b/tests/functional-tests/test-extraction-data/desktop/link-wikipedia-tracker.expected.json
@@ -4,8 +4,8 @@
},
"metadata": {
"nie:title" : "Wikipedia Tracker",
- "nie:isStoredAs": {
- "@id": "urn:link:https:%2F%2Fen.wikipedia.org%2Fwiki%2FTracker_(search_software)",
+ "nfo:bookmarks": {
+ "@id": "https://en.wikipedia.org/wiki/Tracker_(search_software)",
"@type": [
"nie:DataObject",
"nfo:Website"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]