]> arthur.barton.de Git - netatalk.git/blob - etc/afpd/spotlight_SPARQL_map.c
Add support for filetype search
[netatalk.git] / etc / afpd / spotlight_SPARQL_map.c
1 /*
2   Copyright (c) 2012 Frank Lahm <franklahm@gmail.com>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2 of the License, or
7   (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.
13 */
14
15 #ifdef HAVE_CONFIG_H
16 #include "config.h"
17 #endif /* HAVE_CONFIG_H */
18
19 #include <unistd.h>
20
21 #include "spotlight_SPARQL_map.h"
22
23 struct spotlight_sparql_map spotlight_sparql_map[] = {
24     /* ssm_spotlight_attr               ssm_type,   ssm_sparql_attr */
25     {"*",                               ssmt_fts,   "fts:match"},
26
27     /* Filesystem metadata */
28     {"kMDItemFSLabel", ssmt_num, ""},
29     {"kMDItemDisplayName",              ssmt_str,   "nfo:fileName"},
30     {"kMDItemFSName",                   ssmt_str,   "nfo:fileName"},
31     {"kMDItemFSContentChangeDate",      ssmt_date,  "nfo:fileLastModified"},
32
33     /* Common metadata */
34     {"kMDItemTextContent",              ssmt_fts,   "fts:match"},
35     {"kMDItemContentCreationDate",      ssmt_date,  "nie:contentCreated"},
36     {"kMDItemContentModificationDate",  ssmt_date,  "nfo:fileLastModified"},
37     {"kMDItemAttributeChangeDate",      ssmt_date,  "nfo:fileLastModified"},
38     {"kMDItemAuthors",                  ssmt_str,   "dc:creator"},
39     {"kMDItemCopyright",                ssmt_str,   "nie:copyright"},
40     {"kMDItemCountry",                  ssmt_str,   "nco:country"},
41     {"kMDItemCreator",                  ssmt_str,   "dc:creator"},
42     {"kMDItemDurationSeconds",          ssmt_num,   "nfo:duration"},
43     {"kMDItemNumberOfPages",            ssmt_num,   "nfo:pageCount"},
44     {"kMDItemTitle",                    ssmt_str,   "nie:title"},
45     {"_kMDItemGroupId",                 ssmt_type,  NULL},
46     {"kMDItemContentTypeTree",          ssmt_type,  NULL},
47
48     /* Image metadata */
49     {"kMDItemPixelWidth",               ssmt_num,   "nfo:width"},
50     {"kMDItemPixelHeight",              ssmt_num,   "nfo:height"},
51     {"kMDItemColorSpace",               ssmt_str,   "nexif:colorSpace"},
52     {"kMDItemBitsPerSample",            ssmt_num,   "nfo:colorDepth"},
53     {"kMDItemFocalLength",              ssmt_num,   "nmm:focalLength"},
54     {"kMDItemISOSpeed",                 ssmt_num,   "nmm:isoSpeed"},
55     {"kMDItemOrientation",              ssmt_bool,  "nfo:orientation"},
56     {"kMDItemResolutionWidthDPI",       ssmt_num,   "nfo:horizontalResolution"},
57     {"kMDItemResolutionHeightDPI",      ssmt_num,   "nfo:verticalResolution"},
58     {"kMDItemExposureTimeSeconds",      ssmt_num,   "nmm:exposureTime"},
59
60     /* Audio metadata */
61     {"kMDItemComposer",                 ssmt_str,   "nmm:composer"},
62     {"kMDItemMusicalGenre",             ssmt_str,   "nfo:genre"},
63
64     {NULL, ssmt_str, NULL}
65 };
66
67 struct MDTypeMap MDTypeMap[] = {
68     {"1",                       kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#Email"},
69     {"2",                       kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#Contact"},
70     {"3",                       kMDTypeMapNotSup,   NULL}, /* PrefPane */
71     {"4",                       kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Font"},
72     {"5",                       kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Bookmark"},
73     {"6",                       kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#Contact"},
74     {"7",                       kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Video"},
75     {"8",                       kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Executable"},
76     {"9",                       kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Folder"},
77     {"10",                      kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Audio"},
78     {"11",                      kMDTypeMapMime,     "application/pdf"},
79     {"12",                      kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Presentation"},
80     {"13",                      kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Image"},
81     {"public.jpeg",             kMDTypeMapMime,     "image/jpeg"},
82     {"public.tiff",             kMDTypeMapMime,     "image/tiff"},
83     {"com.compuserve.gif",      kMDTypeMapMime,     "image/gif"},
84     {"public.png",              kMDTypeMapMime,     "image/png"},
85     {"com.microsoft.bmp",       kMDTypeMapMime,     "image/bmp"},
86     {"public.content",          kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Document"},
87     {"public.mp3",              kMDTypeMapMime,     "audio/mpeg"},
88     {"public.mpeg-4-audio",     kMDTypeMapMime,     "audio/x-aac"},
89     {"com.apple.application",   kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Software"},
90     {"public.text",             kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#TextDocument"},
91     {"public.plain-text",       kMDTypeMapMime,     "text/plain"},
92     {"public.rtf",              kMDTypeMapMime,     "text/rtf"},
93     {"public.html",             kMDTypeMapMime,     "text/html"},
94     {"public.xml",              kMDTypeMapMime,     "text/xml"},
95     {"public.source-code",      kMDTypeMapRDF,      "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#SourceCode"},
96     {NULL,                      kMDTypeMapNotSup,   NULL}
97 };