[tracker-miners/wip/jfelder/external-reference-fixes: 4/4] libtracker-extract: Use identifier as ExternalReference uri
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/jfelder/external-reference-fixes: 4/4] libtracker-extract: Use identifier as ExternalReference uri
- Date: Sun, 1 Sep 2019 15:02:47 +0000 (UTC)
commit 417b9d4e9f86d2febf925a62e500cbb054e8c01d
Author: Jean Felder <jfelder src gnome org>
Date: Sun Sep 1 15:29:50 2019 +0200
libtracker-extract: Use identifier as ExternalReference uri
Use the external reference identifier as part of the ExternalReference
uri. This should make the uri unique in all cases.
src/libtracker-extract/tracker-resource-helpers.c | 2 +-
.../test-extraction-data/audio/audio-test-1.expected.json | 10 +++++-----
.../test-extraction-data/audio/audio-test-2.expected.json | 10 +++++-----
.../audio/audio-test-vorbis-extractor.expected.json | 10 +++++-----
4 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-resource-helpers.c
b/src/libtracker-extract/tracker-resource-helpers.c
index ff75a344a..56f8f1307 100644
--- a/src/libtracker-extract/tracker-resource-helpers.c
+++ b/src/libtracker-extract/tracker-resource-helpers.c
@@ -161,7 +161,7 @@ tracker_extract_new_external_reference (const char *source_uri,
g_return_val_if_fail (source_uri != NULL && identifier != NULL, NULL);
- uri = tracker_sparql_escape_uri_printf ("urn:ExternalReference:%s", source_uri);
+ uri = tracker_sparql_escape_uri_printf ("urn:ExternalReference:%s:%s", source_uri, identifier);
external_reference = tracker_resource_new (uri);
tracker_resource_set_uri (external_reference, "rdf:type", "tracker:ExternalReference");
diff --git a/tests/functional-tests/test-extraction-data/audio/audio-test-1.expected.json
b/tests/functional-tests/test-extraction-data/audio/audio-test-1.expected.json
index ff550c464..118402228 100644
--- a/tests/functional-tests/test-extraction-data/audio/audio-test-1.expected.json
+++ b/tests/functional-tests/test-extraction-data/audio/audio-test-1.expected.json
@@ -21,7 +21,7 @@
"nmm:artistName": "AbBaby",
"tracker:hasExternalReference": [
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FArtist",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FArtist:234561",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Artist",
"tracker:referenceIdentifier": "234561"
@@ -33,13 +33,13 @@
"nie:title": "SinCos",
"tracker:hasExternalReference": [
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRelease",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRelease:345612",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Release",
"tracker:referenceIdentifier": "345612"
},
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRelease_Group",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRelease_Group:561234",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Release_Group",
"tracker:referenceIdentifier": "561234"
@@ -48,13 +48,13 @@
},
"tracker:hasExternalReference": [
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRecording",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRecording:456123",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Recording",
"tracker:referenceIdentifier": "456123"
},
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FTrack",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FTrack:123456",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Track",
"tracker:referenceIdentifier": "123456"
diff --git a/tests/functional-tests/test-extraction-data/audio/audio-test-2.expected.json
b/tests/functional-tests/test-extraction-data/audio/audio-test-2.expected.json
index ee70bf7da..1d5d4306b 100644
--- a/tests/functional-tests/test-extraction-data/audio/audio-test-2.expected.json
+++ b/tests/functional-tests/test-extraction-data/audio/audio-test-2.expected.json
@@ -19,7 +19,7 @@
"nmm:artistName": "Anna Abreu",
"tracker:hasExternalReference": [
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FArtist",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FArtist:234561",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Artist",
"tracker:referenceIdentifier": "234561"
@@ -30,13 +30,13 @@
"@type": "nmm:MusicAlbum",
"tracker:hasExternalReference": [
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRelease",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRelease:345612",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Release",
"tracker:referenceIdentifier": "345612"
},
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRelease_Group",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRelease_Group:561234",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Release_Group",
"tracker:referenceIdentifier": "561234"
@@ -45,13 +45,13 @@
},
"tracker:hasExternalReference": [
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRecording",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRecording:456123",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Recording",
"tracker:referenceIdentifier": "456123"
},
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FTrack",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FTrack:123456",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Track",
"tracker:referenceIdentifier": "123456"
diff --git a/tests/functional-tests/test-extraction-data/audio/audio-test-vorbis-extractor.expected.json
b/tests/functional-tests/test-extraction-data/audio/audio-test-vorbis-extractor.expected.json
index fbcda2441..c4d40a2b6 100644
--- a/tests/functional-tests/test-extraction-data/audio/audio-test-vorbis-extractor.expected.json
+++ b/tests/functional-tests/test-extraction-data/audio/audio-test-vorbis-extractor.expected.json
@@ -16,7 +16,7 @@
"@type": "nmm:Artist",
"nmm:artistName": "AbBaby",
"tracker:hasExternalReference": {
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FArtist",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FArtist:234561",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Artist",
"tracker:referenceIdentifier": "234561"
@@ -27,13 +27,13 @@
"nie:title": "SinCos",
"tracker:hasExternalReference": [
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRelease",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRelease:345612",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Release",
"tracker:referenceIdentifier": "345612"
},
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRelease_Group",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRelease_Group:561234",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Release_Group",
"tracker:referenceIdentifier": "561234"
@@ -42,13 +42,13 @@
},
"tracker:hasExternalReference": [
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRecording",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FRecording:456123",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Recording",
"tracker:referenceIdentifier": "456123"
},
{
- "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FTrack",
+ "@id": "urn:ExternalReference:https:%2F%2Fmusicbrainz.org%2Fdoc%2FTrack:123456",
"@type": "tracker:ExternalReference",
"tracker:referenceSource": "https://musicbrainz.org/doc/Track",
"tracker:referenceIdentifier": "123456"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]