type_defs.pl 1.37 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
%! abs_path_type(-Type) is det.
%
% Return the type definition for an absolute path used to identify items. Type 
% is a valid type as defined by types:check_type_def/1.
abs_path_type(atom('^(/|.*[^/])$')).

%! item_type(-Type) is det.
%
% Generates the type definition for an item (that is a file or a directory). 
% Type is a valid type as defined by types:check_type_def/1.
item_type(anyof([DirectoryType,FileType])) :-
    directory_type(DirectoryType),
    file_type(FileType).
    
%! file_type(-Type) is det.
%
% Generates the type definition for a file. Type is a valid type as defined by
% types:check_type_def/1.
file_type(dict([
                abs_path: AbsPathType,
                type: atom('^file$'),
                file_size: positive_integer,
                media_type: atom,
                filename_extension: atom,
                creation_time: integer,
                modification_time: integer,
                access_time: integer,
                change_time: integer
          ])) :-  abs_path_type(AbsPathType).

%! directory_type(-Type) is det.
%
% Generates the type definition for a directory. Type is a valid type as defined 
% by types:check_type_def/1.
directory_type(dict([
                      abs_path: AbsPathType,
                      creation_time: integer,
                      type:atom('^directory$')
                    ])) :- abs_path_type(AbsPathType).