2 Unix SMB/CIFS implementation.
3 Main metadata server / Spotlight routines
5 Copyright (C) Ralph Boehme 2012-2014
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "sparql_mapping.h"
24 const struct sl_attr_map
*sl_attr_map_by_spotlight(const char *sl_attr
)
26 static const struct sl_attr_map spotlight_sparql_attr_map
[] = {
28 .spotlight_attr
= "*",
30 .sparql_attr
= "fts:match",
33 /* Filesystem metadata */
35 .spotlight_attr
= "kMDItemFSLabel",
40 .spotlight_attr
= "kMDItemDisplayName",
42 .sparql_attr
= "nfo:fileName",
45 .spotlight_attr
= "kMDItemFSName",
47 .sparql_attr
= "nfo:fileName",
50 .spotlight_attr
= "kMDItemFSContentChangeDate",
52 .sparql_attr
= "nfo:fileLastModified",
55 .spotlight_attr
= "kMDItemLastUsedDate",
57 .sparql_attr
= "nfo:fileLastAccessed",
62 .spotlight_attr
= "kMDItemTextContent",
64 .sparql_attr
= "fts:match",
67 .spotlight_attr
= "kMDItemContentCreationDate",
69 .sparql_attr
= "nie:contentCreated",
72 .spotlight_attr
= "kMDItemContentModificationDate",
74 .sparql_attr
= "nfo:fileLastModified",
77 .spotlight_attr
= "kMDItemAttributeChangeDate",
79 .sparql_attr
= "nfo:fileLastModified",
82 .spotlight_attr
= "kMDItemAuthors",
84 .sparql_attr
= "dc:creator",
87 .spotlight_attr
= "kMDItemCopyright",
89 .sparql_attr
= "nie:copyright",
92 .spotlight_attr
= "kMDItemCountry",
94 .sparql_attr
= "nco:country",
97 .spotlight_attr
= "kMDItemCreator",
99 .sparql_attr
= "dc:creator",
102 .spotlight_attr
= "kMDItemDurationSeconds",
104 .sparql_attr
= "nfo:duration",
107 .spotlight_attr
= "kMDItemNumberOfPages",
109 .sparql_attr
= "nfo:pageCount",
112 .spotlight_attr
= "kMDItemTitle",
114 .sparql_attr
= "nie:title",
117 .spotlight_attr
= "kMDItemCity",
119 .sparql_attr
= "nco:locality",
122 .spotlight_attr
= "kMDItemCoverage",
124 .sparql_attr
= "nco:locality",
127 .spotlight_attr
= "_kMDItemGroupId",
132 .spotlight_attr
= "kMDItemContentTypeTree",
137 .spotlight_attr
= "kMDItemContentType",
144 .spotlight_attr
= "kMDItemPixelWidth",
146 .sparql_attr
= "nfo:width",
149 .spotlight_attr
= "kMDItemPixelHeight",
151 .sparql_attr
= "nfo:height",
154 .spotlight_attr
= "kMDItemColorSpace",
156 .sparql_attr
= "nexif:colorSpace",
159 .spotlight_attr
= "kMDItemBitsPerSample",
161 .sparql_attr
= "nfo:colorDepth",
164 .spotlight_attr
= "kMDItemFocalLength",
166 .sparql_attr
= "nmm:focalLength",
169 .spotlight_attr
= "kMDItemISOSpeed",
171 .sparql_attr
= "nmm:isoSpeed",
174 .spotlight_attr
= "kMDItemOrientation",
176 .sparql_attr
= "nfo:orientation",
179 .spotlight_attr
= "kMDItemResolutionWidthDPI",
181 .sparql_attr
= "nfo:horizontalResolution",
184 .spotlight_attr
= "kMDItemResolutionHeightDPI",
186 .sparql_attr
= "nfo:verticalResolution",
189 .spotlight_attr
= "kMDItemExposureTimeSeconds",
191 .sparql_attr
= "nmm:exposureTime",
196 .spotlight_attr
= "kMDItemComposer",
198 .sparql_attr
= "nmm:composer",
201 .spotlight_attr
= "kMDItemMusicalGenre",
203 .sparql_attr
= "nfo:genre",
208 for (i
= 0; i
< ARRAY_SIZE(spotlight_sparql_attr_map
); i
++) {
209 const struct sl_attr_map
*m
= &spotlight_sparql_attr_map
[i
];
212 cmp
= strcmp(m
->spotlight_attr
, sl_attr
);
221 const struct sl_type_map
*sl_type_map_by_spotlight(const char *sl_type
)
223 static const struct sl_type_map spotlight_sparql_type_map
[] = {
225 .spotlight_type
= "1",
226 .type
= kMDTypeMapRDF
,
227 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#Email",
230 .spotlight_type
= "2",
231 .type
= kMDTypeMapRDF
,
232 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#Contact",
235 .spotlight_type
= "3",
236 .type
= kMDTypeMapNotSup
,
237 .sparql_type
= NULL
, /*PrefPane*/
240 .spotlight_type
= "4",
241 .type
= kMDTypeMapRDF
,
242 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Font",
245 .spotlight_type
= "5",
246 .type
= kMDTypeMapRDF
,
247 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Bookmark",
250 .spotlight_type
= "6",
251 .type
= kMDTypeMapRDF
,
252 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#Contact",
255 .spotlight_type
= "7",
256 .type
= kMDTypeMapRDF
,
257 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Video",
260 .spotlight_type
= "8",
261 .type
= kMDTypeMapRDF
,
262 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Executable",
265 .spotlight_type
= "9",
266 .type
= kMDTypeMapRDF
,
267 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Folder",
270 .spotlight_type
= "10",
271 .type
= kMDTypeMapRDF
,
272 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Audio",
275 .spotlight_type
= "11",
276 .type
= kMDTypeMapMime
,
277 .sparql_type
= "application/pdf",
280 .spotlight_type
= "12",
281 .type
= kMDTypeMapRDF
,
282 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Presentation",
285 .spotlight_type
= "13",
286 .type
= kMDTypeMapRDF
,
287 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Image",
290 .spotlight_type
= "public.jpeg",
291 .type
= kMDTypeMapMime
,
292 .sparql_type
= "image/jpeg",
295 .spotlight_type
= "public.tiff",
296 .type
= kMDTypeMapMime
,
297 .sparql_type
= "image/tiff",
300 .spotlight_type
= "com.compuserve.gif",
301 .type
= kMDTypeMapMime
,
302 .sparql_type
= "image/gif",
305 .spotlight_type
= "public.png",
306 .type
= kMDTypeMapMime
,
307 .sparql_type
= "image/png",
310 .spotlight_type
= "com.microsoft.bmp",
311 .type
= kMDTypeMapMime
,
312 .sparql_type
= "image/bmp",
315 .spotlight_type
= "public.content",
316 .type
= kMDTypeMapRDF
,
317 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Document",
320 .spotlight_type
= "public.mp3",
321 .type
= kMDTypeMapMime
,
322 .sparql_type
= "audio/mpeg",
325 .spotlight_type
= "public.mpeg-4-audio",
326 .type
= kMDTypeMapMime
,
327 .sparql_type
= "audio/x-aac",
330 .spotlight_type
= "com.apple.application",
331 .type
= kMDTypeMapRDF
,
332 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Software",
335 .spotlight_type
= "public.text",
336 .type
= kMDTypeMapRDF
,
337 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#TextDocument",
340 .spotlight_type
= "public.plain-text",
341 .type
= kMDTypeMapMime
,
342 .sparql_type
= "text/plain",
345 .spotlight_type
= "public.rtf",
346 .type
= kMDTypeMapMime
,
347 .sparql_type
= "text/rtf",
350 .spotlight_type
= "public.html",
351 .type
= kMDTypeMapMime
,
352 .sparql_type
= "text/html",
355 .spotlight_type
= "public.xml",
356 .type
= kMDTypeMapMime
,
357 .sparql_type
= "text/xml",
360 .spotlight_type
= "public.source-code",
361 .type
= kMDTypeMapRDF
,
362 .sparql_type
= "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#SourceCode",
367 for (i
= 0; i
< ARRAY_SIZE(spotlight_sparql_type_map
); i
++) {
368 const struct sl_type_map
*m
= &spotlight_sparql_type_map
[i
];
371 cmp
= strcmp(m
->spotlight_type
, sl_type
);