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
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
test_true([["$Id$"]]); 
 
dnl - Standards.ISO639_2 
test_equal(Standards.ISO639_2.get_language("swe"),"Swedish") 
test_equal(Standards.ISO639_2.get_language("xxx"),0) 
test_true(sizeof(Standards.ISO639_2.list_languages())>400) 
test_egual(Standards.ISO639_2.map_639_1("sv"),"swe") 
test_egual(Standards.ISO639_2.map_639_1("xx"),0) 
test_true(sizeof(Standards.ISO639_2.list_639_1())==161) 
test_false(Standards.ISO639_2.verify_overlap()) 
 
dnl - Standards.RDF 
test_equal_any([[ 
  object r = Standards.RDF(); 
  object x = r->Resource(); 
  r->add_statement( r->URIResource("http://www.example.org/index.html"), 
                    r->URIResource("http://purl.org/dc/elements/1.1/creator"), 
                    x ); 
  object y = r->Resource(); 
  r->add_statement( x, 
                    r->URIResource("http://www.example.org/terms/creation-date"), 
                    y ); 
  r->add_statement( y, 
                    r->URIResource("http://pike.ida.liu.se/terms/ruppar"), 
                    r->LiteralResource("August 16, 1999") ); 
  r->add_statement( x, 
                    r->URIResource("http://www.example.org/terms/language"), 
                    r->LiteralResource("English") ); 
  return (multiset)(r->get_n_triples()/"\n"); 
]], (< /* 5 elements */ 
    "", 
    "_:Resource1 <http://www.example.org/terms/language> \"English\" .", 
    "_:Resource1 <http://www.example.org/terms/creation-date> _:Resource4 .", 
    "<http://www.example.org/index.html> <http://purl.org/dc/elements/1.1/creator> _:Resource1 .", 
    "_:Resource4 <http://pike.ida.liu.se/terms/ruppar> \"August 16, 1999\" ." 
>)) 
 
test_do([[ add_constant("my_rdf", Standards.RDF()); ]]) 
test_any([[ 
  string nt="<http://www.w3.org/2001/08/rdf-test/>  " 
    "<http://purl.org/dc/elements/1.1/creator>    \"Dave Beckett\" .\n" 
    "<http://www.w3.org/2001/08/rdf-test/>  <http://purl.org/dc/elements/1.1/creator>" 
    "    \"Jan Grant\" .\n" 
    "<http://www.w3.org/2001/08/rdf-test/>  <http://purl.org/dc/elements/1.1/publisher>" 
    "  _:a .\n" 
    "_:a                                    <http://purl.org/dc/elements/1.1/title>" 
    "      \"World Wide Web Consortium\" . \n" 
    "_:a                                    <http://purl.org/dc/elements/1.1/source>" 
    "     <http://www.w3.org/> .\n"; 
  return my_rdf->parse_n_triples(nt); 
]], 5) 
test_eq( sizeof(my_rdf), 5) 
test_eq([[ sizeof(my_rdf->find_statements(0,0,0)) ]], 5) 
test_eq([[ sizeof(Array.flatten(my_rdf->find_statements(0,0,0))) ]], 15) 
test_eq([[ sizeof(my_rdf->find_statements( my_rdf-> 
  get_resource("http://www.w3.org/2001/08/rdf-test/"),0,0)) ]], 3) 
test_eq( my_rdf->get_resource(""), 0) 
test_eq([[ sizeof(my_rdf->find_statements(0, my_rdf-> 
  get_resource("http://purl.org/dc/elements/1.1/creator"),0)) ]], 2) 
test_eq([[ sizeof(my_rdf->find_statements(0,0, my_rdf-> 
  get_resource("http://www.w3.org/"))) ]], 1) 
test_any([[ 
  Standards.RDF.Resource r; 
  r = my_rdf->find_statements(0, my_rdf-> 
    get_resource("http://purl.org/dc/elements/1.1/publisher"), 0)[0][2]; 
  return sizeof(my_rdf->find_statements(r,0,0)); 
]], 2) 
test_do( add_constant("my_rdf"); ) 
 
 
dnl - Standards.URI 
test_equal((string)Standards.URI("g:h",           "http://a/b/c/d;p?q"), "g:h") 
test_equal((string)Standards.URI("g",             "http://a/b/c/d;p?q"), "http://a/b/c/g") 
test_equal((string)Standards.URI("./g",           "http://a/b/c/d;p?q"), "http://a/b/c/g") 
test_equal((string)Standards.URI("g/",            "http://a/b/c/d;p?q"), "http://a/b/c/g/") 
test_equal((string)Standards.URI("/g",            "http://a/b/c/d;p?q"), "http://a/g") 
test_equal((string)Standards.URI("//g",           "http://a/b/c/d;p?q"), "http://g") 
test_equal((string)Standards.URI("?y",            "http://a/b/c/d;p?q"), "http://a/b/c/?y") 
test_equal((string)Standards.URI("g?y",           "http://a/b/c/d;p?q"), "http://a/b/c/g?y") 
test_equal((string)Standards.URI("#s",            "http://a/b/c/d;p?q"), "http://a/b/c/d;p?q#s") 
test_equal((string)Standards.URI("g#s",           "http://a/b/c/d;p?q"), "http://a/b/c/g#s") 
test_equal((string)Standards.URI("g?y#s",         "http://a/b/c/d;p?q"), "http://a/b/c/g?y#s") 
test_equal((string)Standards.URI(";x",            "http://a/b/c/d;p?q"), "http://a/b/c/;x") 
test_equal((string)Standards.URI("g;x",           "http://a/b/c/d;p?q"), "http://a/b/c/g;x") 
test_equal((string)Standards.URI("g;x?y#s",       "http://a/b/c/d;p?q"), "http://a/b/c/g;x?y#s") 
test_equal((string)Standards.URI(".",             "http://a/b/c/d;p?q"), "http://a/b/c/") 
test_equal((string)Standards.URI("./",            "http://a/b/c/d;p?q"), "http://a/b/c/") 
test_equal((string)Standards.URI("..",            "http://a/b/c/d;p?q"), "http://a/b/") 
test_equal((string)Standards.URI("../",           "http://a/b/c/d;p?q"), "http://a/b/") 
test_equal((string)Standards.URI("../g",          "http://a/b/c/d;p?q"), "http://a/b/g") 
test_equal((string)Standards.URI("../..",         "http://a/b/c/d;p?q"), "http://a/") 
test_equal((string)Standards.URI("../../",        "http://a/b/c/d;p?q"), "http://a/") 
test_equal((string)Standards.URI("../../g",       "http://a/b/c/d;p?q"), "http://a/g") 
test_equal((string)Standards.URI("../../../g",    "http://a/b/c/d;p?q"), "http://a/../g") 
test_equal((string)Standards.URI("../../../../g", "http://a/b/c/d;p?q"), "http://a/../../g") 
test_equal((string)Standards.URI("/./g",          "http://a/b/c/d;p?q"), "http://a/./g") 
test_equal((string)Standards.URI("/../g",         "http://a/b/c/d;p?q"), "http://a/../g") 
test_equal((string)Standards.URI("g.",            "http://a/b/c/d;p?q"), "http://a/b/c/g.") 
test_equal((string)Standards.URI(".g",            "http://a/b/c/d;p?q"), "http://a/b/c/.g") 
test_equal((string)Standards.URI("g..",           "http://a/b/c/d;p?q"), "http://a/b/c/g..") 
test_equal((string)Standards.URI("..g",           "http://a/b/c/d;p?q"), "http://a/b/c/..g") 
test_equal((string)Standards.URI("./../g",        "http://a/b/c/d;p?q"), "http://a/b/g") 
test_equal((string)Standards.URI("./g/.",         "http://a/b/c/d;p?q"), "http://a/b/c/g/") 
test_equal((string)Standards.URI("g/./h",         "http://a/b/c/d;p?q"), "http://a/b/c/g/h") 
test_equal((string)Standards.URI("g/../h",        "http://a/b/c/d;p?q"), "http://a/b/c/h") 
test_equal((string)Standards.URI("g;x=1/./y",     "http://a/b/c/d;p?q"), "http://a/b/c/g;x=1/y") 
test_equal((string)Standards.URI("g;x=1/../y",    "http://a/b/c/d;p?q"), "http://a/b/c/y") 
test_equal((string)Standards.URI("g?y/./x",       "http://a/b/c/d;p?q"), "http://a/b/c/g?y/./x") 
test_equal((string)Standards.URI("g?y/../x",      "http://a/b/c/d;p?q"), "http://a/b/c/g?y/../x") 
test_equal((string)Standards.URI("g#s/./x",       "http://a/b/c/d;p?q"), "http://a/b/c/g#s/./x") 
test_equal((string)Standards.URI("g#s/../x",      "http://a/b/c/d;p?q"), "http://a/b/c/g#s/../x") 
test_equal((string)Standards.URI("http:g",        "http://a/b/c/d;p?q"), "http:g")