- From: Benjamin Adrian <benjamin.adrian@dfki.de>
- Date: Fri, 16 Apr 2010 17:31:37 +0200
- To: Manu Sporny <msporny@digitalbazaar.com>, RDFa WG <public-rdfa-wg@w3.org>
Manu Sporny schrieb: > The constructs, like XSD["integer"] may be better implemented as > properties of the global "rdfa" object, instead of as global objects > themselves. So, instead of: > > XSD["integer"] => URI("http://www.w3.org/2001/XMLSchema#integer") > > something like this: > > rdfa.xsd.integer => URI("http://www.w3.org/2001/XMLSchema#integer") > > You can add mappings like so: > > rdfa.setMapping("xsd", "integer", > new URI("http://www.w3.org/2001/XMLSchema#integer")); > > But where is the programming logic for this mapping? What transforms the typed literal's value to integer in JS? > or like this: > > rdfa.xsd = { > "integer" : new URI("http://www.w3.org/2001/XMLSchema#integer"), > "string" : new URI("http://www.w3.org/2001/XMLSchema#string"), > "decimal" : new URI("http://www.w3.org/2001/XMLSchema#decimal"), > "float" : new URI("http://www.w3.org/2001/XMLSchema#float"), > "boolean" : new URI("http://www.w3.org/2001/XMLSchema#boolean"), > "date" : new URI("http://www.w3.org/2001/XMLSchema#date"), > "time" : new URI("http://www.w3.org/2001/XMLSchema#time"), > "dateTime" : new URI("http://www.w3.org/2001/XMLSchema#dateTime"), > }; > > Yes it's a good idea to move it to the rdfa scobe. > and use them like so: > > var x = new TypedLiteral("W3C", rdfa.xsd.string); > > Isn't (rdfa.xsd.string == rdfa.xsd["string"]) == true ? Important is: Which vocabularies should we support? Another thing is: What to do think about JSONing these objects, host them on separate documents, and import them by a function: rdfa.importVocabulary(dc, 'http://www.example.org/vocabularies/json/dc.js'); > or even short-cut it by doing this: > > var foaf = rdfa.foaf; > var bk = new RDFTriple("#bk", foaf.name, "Ben Kingsley"); > > that's good! > or with Mark's proposal: > > // print out all of the people names in a page > var people = rdfa.filterObjectsByType(foaf.Person); > for(i in people) > { > var p = people[i]; > if(p[foaf.name]) > { > alert("Found person named: " + p[foaf.name]); > } > } > > I like this though I had to think a time to understand it. It's not easy to see the triples in people. And it's hard to realize this construct in other programming languages. > We also found out that this construct is only valid in Javascript 1.6, > and is not implemented in the ECMA standard: > > for each ([s,p,o] in rdfa.filter(...)) { ... } > oh, didn't they refactor it in JS 1.7 [1] to : for each ([s,p,o] in Iterator(rdfa.filter(...))) { ... } [1] https://developer.mozilla.org/en/New_in_JavaScript_1.7#Destructuring_assignment_%28Merge_into_own_page.2fsection%29 Best regards, Ben -- __________________________________________ Benjamin Adrian Email : benjamin.adrian@dfki.de WWW : http://www.dfki.uni-kl.de/~adrian/ Tel.: +49631 20575 145 __________________________________________ Deutsches Forschungszentrum für Künstliche Intelligenz GmbH Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern Geschäftsführung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender) Dr. Walter Olthoff Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes Amtsgericht Kaiserslautern, HRB 2313 __________________________________________
Received on Friday, 16 April 2010 15:32:12 UTC