iPhone : Complex CSV Parser - iphone
I'd like to parse a complex CSV file. I searched sources on the web but I only found readers for simple csv with coma and quote marks. But mine also contains "{", "[" and ":" in order to create groups, subgroups...
How can I retrieve a proper NSArray or a NSDictionary from this kind of csv ?
Or do you know a great (great !) csv reader/parser ?
Thanks !
Here is an example :
{"meta":{"code":200},"response":{"groups":[{"type":"nearby","name":"À
proximité","items":[{"id":"4bc88ad72f94d13aa9c5137f","name":"Métro
Chaussée d'Antin - La Fayette
[7,9]","contact":{},"location":{"address":"Métro
Chaussée d'Antin - La
Fayette","city":"Paris","state":"Île
de
France","postalCode":"75009","lat":48.872908,"lng":2.33325,"distance":39},"categories":[{"id":"4bf58dd8d48988d1fd931735","name":"Subways","icon":"http://foursquare.com/img/categories/travel/subway.png","parents":["Travel
Spots"],"primary":true}],"verified":false,"stats":{"checkinsCount":885,"usersCount":368},"hereNow":{"count":0}},{"id":"4ba8e508f964a520e4f739e3","name":"AdenClassifieds","contact":{},"location":{"address":"1-3
rue La
Fayette","city":"Paris","state":"France","postalCode":"75009","lat":48.8733461,"lng":2.3340489,"distance":50},"categories":[{"id":"4bf58dd8d48988d124941735","name":"Offices","icon":"http://foursquare.com/img/categories/building/default.png","parents":["Homes,
Work,
Others"],"primary":true}],"verified":false,"stats":{"checkinsCount":187,"usersCount":29},"hereNow":{"count":0}},{"id":"4c10cd34b4aeef3bad5afc0f","name":"AdenSourcing","contact":{},"location":{"address":"1,
rue La
Fayette","city":"Paris","state":"France","postalCode":"75009","lat":48.873009,"lng":2.333263,"distance":28},"categories":[{"id":"4bf58dd8d48988d125941735","name":"Tech
Startups","icon":"http://foursquare.com/img/categories/building/default.png","parents":["Homes,
Work,
Others","Offices"],"primary":true},{"id":"4bf58dd8d48988d174941735","name":"Coworking
Spaces","icon":"http://foursquare.com/img/categories/building/default.png","parents":["Homes,
Work,
Others","Offices"]}],"verified":false,"stats":{"checkinsCount":60,"usersCount":7},"hereNow":{"count":0}},{"id":"4b6d79c2f964a520f6762ce3","name":"Négatif+","contact":{},"location":{"address":"106
rue
lafayette","city":"Paris","state":"France","postalCode":"75010","lat":48.873035,"lng":2.333235,"distance":26},"categories":[{"id":"4bf58dd8d48988d1ff941735","name":"Miscellaneous
Shops","icon":"http://foursquare.com/img/categories/shops/default.png","parents":["Shops"],"primary":true}],"verified":false,"stats":{"checkinsCount":121,"usersCount":51},"hereNow":{"count":0}},{"id":"4beeb21a2c082d7f96b53042","name":"Sephora
Haussmann","contact":{},"location":{"address":"23
bd
Hausmann","city":"Paris","state":"Ile-de-France","lat":48.8728835,"lng":2.3334661,"distance":41},"categories":[{"id":"4bf58dd8d48988d10c951735","name":"Cosmetics
Shops","icon":"http://foursquare.com/img/categories/shops/beauty_cosmetic.png","parents":["Shops"],"primary":true}],"verified":false,"stats":{"checkinsCount":135,"usersCount":75},"hereNow":{"count":0}},{"id":"4af55e08f964a520f3f821e3","name":"Chez
Jean","contact":{},"location":{"address":"4
rue La
Fayette","city":"Paris","state":"France","postalCode":"75009","lat":48.8731558,"lng":2.3334978,"distance":13},"categories":[{"id":"4bf58dd8d48988d118951735","name":"Grocery
Stores","icon":"http://foursquare.com/img/categories/shops/food_grocery.png","parents":["Shops","Food and Drink
Shops"],"primary":true}],"verified":false,"stats":{"checkinsCount":46,"usersCount":27},"hereNow":{"count":0}},{"id":"4bee9a52e8c3c928dfd89892","name":"H&M","contact":{},"location":{"lat":48.872951,"lng":2.333551,"distance":35},"categories":[{"id":"4bf58dd8d48988d104951735","name":"Boutiques","icon":"http://foursquare.com/img/categories/shops/apparel.png","parents":["Shops","Clothing
Stores"],"primary":true}],"verified":false,"stats":{"checkinsCount":84,"usersCount":66},"hereNow":{"count":0}},{"id":"4b51d04df964a520865627e3","name":"Surcouf","contact":{},"location":{"address":"21,
bd
Haussmann","city":"Paris","state":"France","postalCode":"75009","lat":48.8728008,"lng":2.3339615,"distance":65},"categories":[{"id":"4bf58dd8d48988d122951735","name":"High
Tech
Outlets","icon":"http://foursquare.com/img/categories/shops/technology.png","parents":["Shops"],"primary":true}],"verified":false,"stats":{"checkinsCount":332,"usersCount":194},"hereNow":{"count":0}},{"id":"4b1e6795f964a5209a1924e3","name":"Le
Manoir","contact":{},"location":{"address":"34
Boulevard
Haussmann","city":"Paris","state":"France","postalCode":"75009","lat":48.872964707066394,"lng":2.334015369415283,"distance":56},"categories":[{"id":"4bf58dd8d48988d16d941735","name":"Cafés","icon":"http://foursquare.com/img/categories/food/cafe.png","parents":["Food"],"primary":true}],"verified":false,"stats":{"checkinsCount":116,"usersCount":61},"hereNow":{"count":0}},{"id":"4cb59ee81b0af04dca42ca25","name":"Casa
Del
Campo","contact":{},"location":{"address":"Rue
Lafayette","city":"Paris","state":"Ile-de-France","lat":48.873035,"lng":2.333235,"distance":26},"categories":[{"id":"4bf58dd8d48988d1db931735","name":"Tapas
Restaurants","icon":"http://foursquare.com/img/categories/food/default.png","parents":["Food"],"primary":true}],"verified":false,"stats":{"checkinsCount":12,"usersCount":11},"hereNow":{"count":0}},{"id":"4cdd43c0d5495481874446b2","name":"Thalys
Paris >
Bruxelles","contact":{},"location":{"address":"111
rue
Lafayette","city":"Paris","state":"Ile-de-France","postalCode":"75011","lat":48.873035,"lng":2.333235,"distance":26},"categories":[{"id":"4bf58dd8d48988d12a951735","name":"Trains","icon":"http://foursquare.com/img/categories/travel/trainstation.png","parents":["Travel
Spots","Train
Stations"],"primary":true}],"verified":false,"stats":{"checkinsCount":5,"usersCount":5},"hereNow":{"count":0}},{"id":"4ba3d477f964a520226438e3","name":"Les
Diamantaires","contact":{},"location":{"address":"60,
Rue
Lafayette","city":"Paris","state":"Ile-de-France","postalCode":"75009","lat":48.873035,"lng":2.333235,"distance":26},"categories":[{"id":"4bf58dd8d48988d115941735","name":"Middle
Eastern
Restaurants","icon":"http://foursquare.com/img/categories/food/middleeastern.png","parents":["Food"],"primary":true}],"verified":false,"stats":{"checkinsCount":11,"usersCount":10},"hereNow":{"count":0}},{"id":"4cbeb94297bc721e31158167","name":"Dentiste","contact":{},"location":{"address":"36
bd
haussmann","city":"Paris","state":"Ile-de-France","lat":48.8729985,"lng":2.3331688,"distance":31},"categories":[{"id":"4bf58dd8d48988d178941735","name":"Dentist's
Offices","icon":"http://foursquare.com/img/categories/building/medical_dentist.png","parents":["Homes,
Work, Others","Medical
Centers"],"primary":true}],"verified":false,"stats":{"checkinsCount":9,"usersCount":2},"hereNow":{"count":0}},{"id":"4c098514bbc676b0365c48d5","name":"Best
Place To Be
Naked","contact":{},"location":{"lat":48.872859,"lng":2.333289,"distance":43},"categories":[],"verified":false,"stats":{"checkinsCount":36,"usersCount":21},"hereNow":{"count":0}},{"id":"4bbc55912d9ea5937878a0ce","name":"Pizza
Tivoli","contact":{},"location":{"address":"5
rue La
Fayette","city":"Paris","state":"France","postalCode":"75009","lat":48.8733461,"lng":2.3340489,"distance":50},"categories":[{"id":"4bf58dd8d48988d110941735","name":"Italian
Restaurants","icon":"http://foursquare.com/img/categories/food/default.png","parents":["Food"],"primary":true}],"verified":false,"stats":{"checkinsCount":62,"usersCount":47},"hereNow":{"count":0}},{"id":"4be11bf20f03a593908e18b4","name":"Pole
Direction Nvx
Medias","contact":{},"location":{"lat":48.872878,"lng":2.333277,"distance":42},"categories":[],"verified":false,"stats":{"checkinsCount":25,"usersCount":6},"hereNow":{"count":0}},{"id":"4c17d044834e2d7f94f02780","name":"Josefin","contact":{},"location":{"city":"Paris","state":"Ile-de-France","lat":48.872863,"lng":2.333273,"distance":43},"categories":[{"id":"4bf58dd8d48988d10c941735","name":"French
Restaurants","icon":"http://foursquare.com/img/categories/food/default.png","parents":["Food"],"primary":true}],"verified":false,"stats":{"checkinsCount":14,"usersCount":8},"hereNow":{"count":0}},{"id":"4b597cfcf964a520e68928e3","name":"Siege
Danone","contact":{},"location":{"address":"17
boulevard
hausmann","city":"Paris","lat":48.873557,"lng":2.334042,"distance":59},"categories":[{"id":"4bf58dd8d48988d124941735","name":"Offices","icon":"http://foursquare.com/img/categories/building/default.png","parents":["Homes,
Work,
Others"],"primary":true}],"verified":false,"stats":{"checkinsCount":23,"usersCount":13},"hereNow":{"count":0}},{"id":"4c1f5058fcf8c9b6f66bae0b","name":"Obene","contact":{},"location":{"address":"35
rue saint
lazarre","city":"Paris","state":"Francr","postalCode":"75009","lat":48.872829,"lng":2.333201,"distance":48},"categories":[{"id":"4bf58dd8d48988d1c0941735","name":"Mediterranean
Restaurants","icon":"http://foursquare.com/img/categories/food/default.png","parents":["Food"],"primary":true}],"verified":false,"stats":{"checkinsCount":21,"usersCount":5},"hereNow":{"count":0}},{"id":"4d5133ac9ffc236a026720a7","name":"Sofa
Cafe
Studio","contact":{},"location":{"lat":48.873568,"lng":2.33384,"distance":48},"categories":[{"id":"4bf58dd8d48988d10c941735","name":"French
Restaurants","icon":"http://foursquare.com/img/categories/food/default.png","parents":["Food"],"primary":true}],"verified":false,"stats":{"checkinsCount":11,"usersCount":10},"hereNow":{"count":0}},{"id":"4cfa4adf2d80a1438a9f43d8","name":"Manucurist","contact":{},"location":{"address":"Rue
de la chausse d
antin","city":"Paris","state":"Ile-de-France","lat":48.87294352054596,"lng":2.333693504333496,"distance":41},"categories":[{"id":"4bf58dd8d48988d10c951735","name":"Cosmetics
Shops","icon":"http://foursquare.com/img/categories/shops/beauty_cosmetic.png","parents":["Shops"],"primary":true}],"verified":false,"stats":{"checkinsCount":28,"usersCount":4},"hereNow":{"count":0}},{"id":"4c7b90c9794e224bb48d6b28","name":"Le
Galfa - La
Fayette","contact":{},"location":{"lat":48.872853,"lng":2.333072,"distance":49},"categories":[{"id":"4bf58dd8d48988d10c941735","name":"French
Restaurants","icon":"http://foursquare.com/img/categories/food/default.png","parents":["Food"],"primary":true}],"verified":false,"stats":{"checkinsCount":20,"usersCount":15},"hereNow":{"count":0}},{"id":"4c124b6377cea59338bccc60","name":"Noon","contact":{},"location":{"address":"Rue
de la chaussee d
antin","city":"Paris","state":"Ile-de-France","lat":48.8736428,"lng":2.3330026,"distance":51},"categories":[{"id":"4bf58dd8d48988d146941735","name":"Delis
or
Bodegas","icon":"http://foursquare.com/img/categories/food/deli.png","parents":["Food"],"primary":true}],"verified":false,"stats":{"checkinsCount":15,"usersCount":12},"hereNow":{"count":0}},{"id":"4bb2f78ea32876b0173a01fe","name":"Glam
Media France (temp
Offices)","contact":{},"location":{"address":"21
bd
Haussman","city":"Paris","lat":48.87305,"lng":2.333831,"distance":39},"categories":[{"id":"4bf58dd8d48988d125941735","name":"Tech
Startups","icon":"http://foursquare.com/img/categories/building/default.png","parents":["Homes,
Work,
Others","Offices"],"primary":true}],"verified":false,"stats":{"checkinsCount":7,"usersCount":4},"hereNow":{"count":0}},{"id":"4c122cd7583c9c74bf323fa4","name":"Havaianas
welcomes Summer # Galeries
Lafayette","contact":{"phone":"0142823456","twitter":"havaianaseurope"},"location":{"address":"40
boulevard Haussmann","city":"75009
Paris","state":"France","country":"France","lat":48.8731566,"lng":2.3327878,"distance":44},"categories":[{"id":"4bf58dd8d48988d107951735","name":"Shoe
Stores","icon":"http://foursquare.com/img/categories/shops/apparel.png","parents":["Shops","Clothing
Stores"],"primary":true}],"verified":true,"stats":{"checkinsCount":11,"usersCount":9},"hereNow":{"count":0}},{"id":"4b9a40c4f964a52081a735e3","name":"little
georgette","contact":{},"location":{"lat":48.872544,"lng":2.33322,"distance":79},"categories":[{"id":"4bf58dd8d48988d10c941735","name":"French
Restaurants","icon":"http://foursquare.com/img/categories/food/default.png","parents":["Food"],"primary":true}],"verified":false,"stats":{"checkinsCount":60,"usersCount":41},"hereNow":{"count":0}},{"id":"4c319736213c2d7f5e33345d","name":"Isiom","contact":{},"location":{"lat":48.872815,"lng":2.333228,"distance":49},"categories":[{"id":"4bf58dd8d48988d124941735","name":"Offices","icon":"http://foursquare.com/img/categories/building/default.png","parents":["Homes,
Work,
Others"],"primary":true}],"verified":false,"stats":{"checkinsCount":7,"usersCount":2},"hereNow":{"count":0}},{"id":"4c89f5e49ef0224b0595567b","name":"Cardiweb","contact":{},"location":{"city":"Paris","state":"Ile-de-France","lat":48.873727,"lng":2.33362,"distance":55},"categories":[{"id":"4bf58dd8d48988d124941735","name":"Offices","icon":"http://foursquare.com/img/categories/building/default.png","parents":["Homes,
Work,
Others"],"primary":true}],"verified":false,"stats":{"checkinsCount":5,"usersCount":3},"hereNow":{"count":0}},{"id":"4c507cf7991c20a18e014786","name":"Focus
Groups","contact":{},"location":{"lat":48.872982,"lng":2.33353,"distance":31},"categories":[{"id":"4bf58dd8d48988d124941735","name":"Offices","icon":"http://foursquare.com/img/categories/building/default.png","parents":["Homes,
Work,
Others"],"primary":true}],"verified":false,"stats":{"checkinsCount":1,"usersCount":1},"hereNow":{"count":0}}]}]}}
That looks like JSON, not CSV. Use this JSON Framework to parse the file: http://code.google.com/p/json-framework/
Related
MongoDB full text inconsistent results
I'm going deep into full-text search features and i'm finding some strange behaviors I cannot explain. Here is a simple batch I run to setup my db for the test. use MusicDB db.songs.insertMany([{ "rank": 1000, "authors": ["Pink Floyd"], "title": [ { "language": "en", "text": "Comfortably numb" }, { "language": "it", "text": "Piacevolmente insensibile" } ], "text": [ { "language": "en", "text": "Hello, Is there anybody in there? Just nod if you can hear me Is there anyone at home? Come on now I hear you're feeling down I can ease your pain And get you on your feet again Relax I'll need some information first Just the basic facts Can you show me where it hurts There is no pain, you are receding A distant ship smoke on the horizon You are coming through in waves Your lips move but I can't hear what you're saying When I was a child I had a fever My hands felt just like two balloons Now I've got that feeling once again I can't explain, you would not understand This is now how I am I have become comfortably numb O.K. Just a little pin prick There'll be no more aaaaaaaah! But you may feel a little sick Can you stand up? I do belive it's working, good That'll keep you going through the show Come on it's time to go. There is no pain you are receding A distant ship smoke on the horizon You are only coming through in waves our lips move but I can't hear what you're saying When I was a child I caught a fleeting glimpse Out of the corner of my eye I turned to look but it was gone I cannot put my finger on it now The child is grown The dream is gone And I have become Comfortably numb."}, { "language": "it", "text": "Coraggio, lo so che ti senti triste. Posso alleviare il tuo dolore e rimetterti di nuovo in piedi. Rilassati. Prima di tutto ho bisogno di sapere senza troppi dettagli dove ti fa male. Il dolore è sparito, stai guarendo Il fumo di una nave lontana all'orizzonte stai risalendo onda dopo onda. Le tue labbra si muovono, ma io non riesco a sentire quello che stai dicendo. Da bambino ho avuto la febbre, le mie mani erano gonfie come palloni. Adesso avverto di nuovo quella senzazione, non riesco a spiegartelo, non riusciresti a capire. Questo non sono io. Sto diventando piacevolmente insensibile. Va bene, solo una punturina, e non piangerai più. Ma può darsi che avrai un po' di nausea, Ce la fai a stare in piedi? Penso che stia funzionando, bene. Questo ti terrà in piedi per tutto lo spettacolo. Dai, è ora di andare. Il dolore è sparito, si sta allontanando. Il fumo di una nave lontana all'orizzonte Stai risalendo onda dopo onda. Le tue labbra si muovono, ma io non riesco a sentire quello che stai dicendo. Da bambino colsi con la coda dell'occhio un rapido movimento. Mi girai a guardare, ma era sparito, non riescii a capire cosa fosse, adesso il bambino è cresciuto, il sogno è finito. e io sono diventato piacevolmente insensibile."} ] }, { "rank": 999, "authors": ["Led Zeppelin"], "title": [ { "language": "en", "text": "Stairway to Heaven" }, { "language": "it", "text": "Scalinata per il paradiso" } ], "text": [ { "language": "en", "text": "There's a lady who's sure all that glitters is gold And she's buying a stairway to heaven. When she gets there she knows, if the stores are all closed With a word she can get what she came for. Ooh, ooh, and she's buying a stairway to heaven. There's a sign on the wall but she wants to be sure 'Cause you know sometimes words have two meanings. In a tree by the brook, there's a songbird who sings, Sometimes all of our thoughts are misgiven. Ooh, it makes me wonder, Ooh, it makes me wonder. There's a feeling I get when I look to the west, And my spirit is crying for leaving. In my thoughts I have seen rings of smoke through the trees, And the voices of those who standing looking. Ooh, it makes me wonder,Ooh, it really makes me wonder. And it's whispered that soon if we all call the tune Then the piper will lead us to reason. And a new day will dawn for those who stand long And the forests will echo with laughter. If there's a bustle in your hedgerow, don't be alarmed now, It's just a spring clean for the May queen. Yes, there are two paths you can go by, but in the long run There's still time to change the road you're on. And it makes me wonder. Your head is humming and it won't go, in case you don't know, The piper's calling you to join him, Dear lady, can you hear the wind blow, and did you know Your stairway lies on the whispering wind. And as we wind on down the road Our shadows taller than our soul. There walks a lady we all know Who shines white light and wants to show How ev'rything still turns to gold. And if you listen very hard The tune will come to you at last. When all are one and one is all To be a rock and not to roll. And she's buying a stairway to Heaven."}, { "language": "it", "text": "C'è una donna che crede che tutto cio che luccica sia oro Ha intenzione di comprare una scala per raggiungere il Paradiso E quando vi arriva sa, se i negozi sono chiusi, con una parola può avere ciò per cui è venuta qui Ooh, ooh, e sta comprando una scala per il paradiso. C'è una scritta sul muro, ma lei vuole essere sicura Perchè, lo sai, a volte le parole hanni due significati Su un albero vicino al ponte, c'è un uccellino che canta A volte, tutti i nostri pensieri sono sospetti. Ooh, e mi domando, Ooh, e mi domando. Quella sensazione che provo quando guardo verso Ovest E la mia anima grida di partire Nei miei pensieri ho visto spirali di fumo tra gli alberi. E le voci di quelli che stanno a guardare Ooh, e mi fa pensare, Ooh, e mi fa pensare. E si mormora che presto, se tutti canteremo la melodia il pifferaio ci guiderà alla ragione e un nuovo giorno spunterà per quelli che stavano aspettando da tanto E le foreste eccheggeranno di risate. Se c'è una via vai sul tuo sentiero, non ti allarmare Sono solo i preparativi per la reginetta di Maggio Si, ci sono due strade che puoi percorrere, ma alla fine farai ancora tempo a cambiare il tuo percorso. E mi fa pensare La tua testa canitcchia e quella melodia non se ne andrà, nel caso non lo sapessi, Il pifferaio ti sta chiamando, vuole che tu vada da lui. Dolce donna, senti il vento soffiare e lo sapevi che la tua scala poggia sui sussurri del vento. E mentre scendiamo lungo la strada e le nostre ombre sono più alte della nostra anima Là cammina una signora che noi tutti conosciamo che fa splendere una luce bianca e vuol mostrarci come tutto continui a tramutarsi in oro. E se ascolti molto attentamente Prima o poi la melodia giungerà a te Quando tutti sono uno e una cosa sola è tutto essere una roccia ma senza rotolare. E sta comprando una scala verso il Paradiso."} ] }]); db.songs.createIndex({ "title.text": "text", "text.text": "text" }) Now please notice that the word "lady" appears only one time into the "en" text of the second record. Now I runs the following queries db.songs.find({ "$text": { "$search": "lady", "$language": "it" }}) // no occurrences found db.songs.find({ "$text": { "$search": "lady", "$language": "en" }}) // one occurrence found db.songs.find({ "$text": { "$search": "lady", "$language": "none" }}) // no occurrences found Unfortunately this does not match the documentation that say "language" field is only_ used for stemming so I figure that all the searches should return exactly one document. "$search": "lady" with "$language": "en" // "lady" is stemmed to "ladi" so this match "lady" and "ladies" "$search": "lady" with "$language": "it" // "lady" is stemmed exactly to "lady" so this match "lady" "$search": "lady" with "$language": "none" // "lady" is not stemmed but tokenization results in "lady" so this match "lady" Can someone explain if I'm going wrong in creating the index of in reading the results? Thanks.
Query an array of Objects matching word in a string field
After executing a query on a huge ontology using Jena, I exported the results in JSON format in a MongoDB collection named items in a database named galileo. Now I want to query on the collection to find items by their names (names are in the title field), in particular I want that searching for "Astrolabio", I can retrieve all the objects that contain the word "Astrolabio" in the title field (e.g. "Astrolabio", "Astrolabio Piano" etc...).The objects that interest me are contained in the #graph array. I tried db.items.find({"#graph":{$elemMatch:{"title":{$regex: /Astrolabio$/}}}}) but it returns lots of objects that don't contain the searched word too. I tried also db.items.find({},{"#graph":{$elemMatch:{"title":{$regex: /Astrolabio$/}}}}) but, as I discovered only after my try, it returns only the first object that match the request. So what's the correct query for what I'm trying to do? In order to provide an help, here there is a little slice of the document { "_id" : ObjectId("59e07632b5d295462b330c4c"), "#graph" : [ { "#id" : "http://minerva.atcult.it/rdf/000000016001", "#type" : [ "bibo:Book", "bibo:MultiVolumeBook" ], "P1053" : [ "1 astrolabe", "1 astrolabio" ], "abstract" : [ "This astrolabe presently comprises two tympanums, for latitudes 30° and 33°, the other for latitudes 36° and 42° (corresponding to the regions between Persia and the Black Sea). There is an alidade, a rule, and a rete. The back carries a double shadow square and the zodiacal calendar. The instrument comes with a tooled black leather case (cover missing) containing a sixteenth-century manuscript note stating that the astrolabe was brought from Spain and dates from 1252. The astronomical data inscribed on the astrolabe suggest it may have been built before 1000. According to tradition, the instrument dates from the period of Charlemagne (9th C. ). A very similar Arab astrolabe is documented in a drawing by Antonio da Sangallo il Giovane [the Younger] (c. 1520?) at the Gabinetto dei Disegni e delle Stampe (Department of Drawings and Prints) of the Uffizi. Provenance: Medici collections", "Questo astrolabio contiene attualmente due timpani, uno per le latitudini 30° e 33°, e l'altro 36° e 42° (corrispondenti alle regioni comprese tra la Persia e il Mar Nero). È completo di alidada, di regolo e di rete. Nel dorso presenta un doppio quadrato delle ombre e il calendario zodiacale. Lo strumento, proveniente dalle collezioni medicee, è completo di custodia di pelle nera lavorata (coperchio mancante) che porta all'interno una nota manoscritta del XVI secolo nella quale si ricorda che l'astrolabio fu portato dalla Spagna e che risale al 1252. I dati astronomici riportati sullo strumento suggeriscono di anticiparne la costruzione a prima del 1000. Secondo la tradizione si tratterebbe di uno strumento del tempo di Carlo Magno (IX secolo). Un astrolabio arabo molto simile a questo è documentato in un disegno di Antonio da Sangallo il Giovane (c. 1520?) conservato presso il Gabinetto dei Disegni e delle Stampe degli Uffizi. Proviene dalle collezioni medicee" ], "contributor" : "http://minerva.atcult.it/rdf/ed494c3a-2ba6-3464-b34a-a57e4f70c5e0", "creator" : [ "http://minerva.atcult.it/rdf/d481cbac-209b-3741-bba4-906590d805b3", "http://minerva.atcult.it/rdf/36e6efa2-6c8f-350e-ae37-479dade48850", "http://minerva.atcult.it/rdf/47734211-2637-3895-a690-4f33412931ec" ], "identifier" : "000000016001", "issued" : "sec. X", "publisher" : "http://minerva.atcult.it/rdf/90310a84-1133-3356-bb3b-647ae1a7d14d", "title" : "Astrolabio piano", "numPages" : [ "1 astrolabio", "1 astrolabe" ], "placeOfPublication" : "Fattura araba", "label" : "Astrolabio piano" }, { "#id" : "http://minerva.atcult.it/rdf/000000016002", "#type" : [ "bibo:MultiVolumeBook", "bibo:Book" ], "P1053" : [ "1 astrolabe", "1 astrolabio" ], "abstract" : [ "Questo piccolo astrolabio contiene quattro timpani per le latitudini 24° e 30°, 31° e 35°, 32° e 36° (corrispondenti alla Persia) e per le latitudini 0° (cioè il circolo dell'equatore) e 66°. È completo di alidada e di rete. Il dorso della madre presenta il calendario lunare, secondo l'uso islamico, un quadrato delle ombre e un quadrante. Lo strumento reca la data 496 dell'Egira (1102-1103 dell'età Cristiana) ed è firmato dal suo artefice, Muhammad 'Ibn Abi'l Qasim 'Ibn Bakran, del quale non si hanno notizie. Fu donato al Museo di Storia della Scienza dal Principe fiorentino Tommaso Corsini", "This small astrolabe carries four tympanums for latitudes 24°/30°, 31°/35°, and 32°/36° (corresponding to Persia), and for latitude 0° (i. e. , the circle of the equator) and 66°. There is an alidade and a rete. The back of the mater displays a lunar calendar, in accordance with Islamic use, a shadow square, and a quadrant. The instrument is dated 496 of the Hegira (1102-1103 of the Christian era) and is signed by its maker, Muhammad 'Ibn Abi'l Qasim 'Ibn Bakran, on whom we have no information. Donated to the Museo di Storia della Scienza by the Florentine Prince Tommaso Corsini" ], "creator" : [ "http://minerva.atcult.it/rdf/c5738e64-fb77-354a-8fc8-47164105b5f7", "http://minerva.atcult.it/rdf/3fa79916-cb7f-3574-a3fb-589ca42ebf17" ], "identifier" : "000000016002", "issued" : "1102-1103", "publisher" : "http://minerva.atcult.it/rdf/90310a84-1133-3356-bb3b-647ae1a7d14d", "title" : "Astrolabio piano", "numPages" : [ "1 astrolabio", "1 astrolabe" ], "placeOfPublication" : "Fattura araba", "label" : "Astrolabio piano" },
if you need to have in a result only elements of the #graph array that match the query (if title contains word Astrolabio), you can reach that with the following aggregation framework query: db.items.aggregate([ {$match: {"#graph.title": /Astrolabio/}}, {$unwind: "$#graph"}, {$match: {"#graph.title": /Astrolabio/} }, {$group: {"_id": "$_id", "#graph": {"$push": "$#graph" } }} ]); your regex {$regex: /Astrolabio$/} will return only documents with titles that have 'Astrolabio' as the last word is a sentence ("Astrolabio Piano" will not be included as 'Piano' is the last word here).
Data not appearing on node - Neo4j
I have this csv file Nr_TipoCadeia,Designacao,Descricao 1,Hotel,O hotel � um edif�cio equipado e projectado para albergar as pessoas de forma tempor�ria. 2,Pousada,"As pousadas podem ser uma �tima alternativa aos hot�is, com pre�os mais atrativos e atendimento personalizado." 3,Motel,Motel � um estabelecimento de hospedagem que se diferencia dos demais porque as pessoas geralmente v�o at� ele com o objetivo de manter rela��es sexuais e n�o necess ariamente para conseguir alojamento. 4,Pensao,"Casa em que se admitem h�spedes, mediante pagamento." 5,Resort," Os resorts possuem servi�os variados de est�tica, quadras poliesportivas e muitas piscinas." I am trying to import the file to Neo4j using the following query: load csv with headers from 'file:///TipoCadeia.csv' as line create (tipocadeia:TipoCadeia {Nr_TipoCadeia: TOINT(line.Nr_TipoCadeia)}) set tipocadeia.Designacao = line.Designacao, tipocadeia.Descricao = line.Descricao return tipocadeia; Everything is ok, except in the node where the third line of the csv file should be stored, it only appears <id>:317 when it should be like <id>:317 Nr_TipoCadeia:3 Designacao:Motel Descricao:.... The other nodes are fine. Why is this happening?
Parsing JSON in objective-c can't understand how get a parameter
{"updated":1350213484,"id":"http://www.google.com/reader/api/0/feed-finder?q\u003dProva\u0026output\u003djson","title":"Risultati di feed per \"Prova\"","self":[{"href":"http://www.google.com/reader/api/0/feed-finder?q\u003dProva\u0026output\u003djson"}],"items":[{"title":"Home Page - La prova del cuoco","id":"http://www.laprovadelcuoco.rai.it/","updated":1350213485,"feed":[{"href":"http://www.laprovadelcuoco.rai.it/dl/portali/site/page/Page-ffb545b4-9e72-41e5-866f-a465588c43fa-rss.html"}],"alternate":[ {"href":"http://www.laprovadelcuoco.rai.it/","type":"text/html"}],"content":{"direction":"ltr","content":"Diventa un cuoco provetto con “La Prova del Cuoco”: le videoricette in un' applicazione di facile e veloce consultazione per il tuo Iphone. Scopri come acquistare ..."}},{"title":"Le prove Invalsi di matematica e italiano","id":"http://online.scuola.zanichelli.it/quartaprova/","updated":1350213486,"feed":[{"href":"http://online.scuola.zanichelli.it/quartaprova/feed/"}],"alternate":[{"href":"http://online.scuola.zanichelli.it/quartaprova/", "type":"text/html"}],"content":{"direction":"ltr","content":"Un sito Zanichelli dedicato alle prove Invalsi di italiano e matematica: esercitazioni, consigli, informazioni utili, novità, aggiornamenti e blog d'autore sulle prove ..."}},{"title":"A Prova di Mamma","id":"http://www.aprovadimamma.net/","updated":1350213487,"feed":[{"href":"http://aprovadimamma.blogspot.com/feeds/posts/default"}],"alternate":[{"href":"http://www.aprovadimamma.net/","type":"text/html"}],"content":{"direction":"ltr", "content":"recensioni, guide ed opinioni sui prodotti per bambini. web | www. \u003ca href\u003d\"http://aprovadimamma.net\"\u003eaprovadimamma.net\u003c/a\u003e email | aprovadimamma -at- \u003ca href\u003d\"http://gmail.com\"\u003egmail.com\u003c/a\u003e. 2011 A Prova di Mamma è un ..."}},{"title":"prova - Wiktionary","id":"http://en.wiktionary.org/wiki/prova","updated":1350213488,"feed":[{"href":"http://en.wiktionary.org/w/index.php?title\u003dSpecial:RecentChanges\u0026feed\u003datom"}],"alternate":[ {"href":"http://en.wiktionary.org/wiki/prova","type":"text/html"}],"content":{"direction":"ltr","content":"prova. Definition from Wiktionary, the free dictionary. Jump to: navigation, search. See also pröva, and próva. Contents. 1 Catalan. 1.1 Noun; 1.2 Verb. 2 Italian ..."}},{"title":"Prova a prendermi - MYmovies","id":"http://www.mymovies.it/dizionario/recensione.asp?id\u003d34298","updated":1350213489,"feed":[{"href":"http://www.mymovies.it/cinema/xml/rss/"}],"alternate":[{"href":"http://www.mymovies.it/dizionario/recensione.asp?id\u003d34298", "type":"text/html"}],"content":{"direction":"ltr","content":"Un film di Steven Spielberg con Leonardo DiCaprio, Tom Hanks, Christopher Walken, Martin Sheen. Spielberg decide di divertire e divertirsi, con un cast ..."}},{"title":"Prova a incastrarmi - MYmovies","id":"http://www.mymovies.it/dizionario/recensione.asp?id\u003d35955","updated":1350213490,"feed":[{"href":"http://www.mymovies.it/cinema/xml/rss/"}],"alternate":[{"href":"http://www.mymovies.it/dizionario/recensione.asp?id\u003d35955", "type":"text/html"}],"content":{"direction":"ltr","content":"Un film di Sidney Lumet con Vin Diesel, Peter Dinklage, Linus Roache, Ron Silver. Il processo per mafia più lungo della storia degli Usa nelle mani di Lumet e ..."}},{"title":"Impariamo.info","id":"http://www.impariamo.info/","updated":1350213491,"feed":[{"href":"http://www.impariamo.info/feeds/posts/default"}],"alternate":[{"href":"http://www.impariamo.info/","type":"text/html"}],"content":{"direction":"ltr","content":"Impariamo.info. Prova il tuo italiano. Pages. Home · Cultura · Chat ... Prove di ascolto. Dettati · Livello A2 · Livello B1 · Livello B2. Giochi. Acrostici · Anagrammi ..." }},{"title":"Schede informative prova scritta di Ateneo - Ca' Foscari","id":"http://www.unive.it/nqcontent.cfm?a_id\u003d134832","updated":1350213492,"feed":[{"href":"http://www.unive.it/phpapps/rss/eventi_rss.php"}],"alternate":[{"href":"http://www.unive.it/nqcontent.cfm?a_id\u003d134832","type":"text/html"}],"content":{"direction":"ltr","content":"Di seguito sono pubblicate le sedi delle prove scritte di Ateneo e, in allegato, ... La prova scritta si svolgerà giovedì 30 agosto alle ore 16.00 presso il Polo di San ..." }},{"title":"Prova d'autore","id":"http://www.osservatorionline.it/page/459/prova-dautore-leggere-per-scrivere","updated":1350213493,"feed":[{"href":"http://www.osservatorionline.it/page/459/rss-news.php?lang\u003dit"}],"alternate":[{"href":"http://www.osservatorionline.it/page/459/prova-dautore-leggere-per-scrivere","type":"text/html"}],"content":{"direction":"ltr","content":"Prova d'autore: leggere per scrivere. Edizione 2012/2013. Per l'anno scolastico 2012-2013 l'Osservatorio Permanente Giovani-Editori e la Fondazione Achille e ..." }},{"title":"Maturità, la terza prova scritta ma potrebbe essere l'ultima volta ...","id":"http://www.repubblica.it/scuola/2012/06/24/news/terza_prova_maturita-37857437/","updated":1350213494,"feed":[{"href":"http://www.repubblica.it/rss/homepage/rss2.0.xml"}],"alternate":[{"href":"http://www.repubblica.it/scuola/2012/06/24/news/terza_prova_maturita-37857437/","type":"text/html"}],"content":{"direction":"ltr","content":"24 giu 2012 ... Predisposta la mattina stessa dalle commissioni, comporta spesso molte difficoltà per gli studenti. Subito dopo inizia la correzione degli ..." }}]} How can I parse it? I'm doing NSArray* title = [(NSDictionary*)[daParsare JSONValue] objectForKey:#"title"]; NSLog(title); I get Risultati di feed per \"Prova\ but what I want are all "title" inside the "items" and the "feed" parameter... I want to store they in one array How can I do? ******* EDIT ******** Ok but when I try to get the feed url I get a SIGABRT error NSDictionary *element=[feeds objectAtIndex:indexPath.row]; NSString *title = [[NSString alloc]initWithString:[element objectForKey:#"title"]]; NSString *summary = [[NSString alloc]initWithString:[element valueForKeyPath:#"feed.href"]]; cell.textLabel.numberOfLines=3; cell.textLabel.font=[UIFont boldSystemFontOfSize:16]; cell.textLabel.text = title; cell.detailTextLabel.text = summary; cell.detailTextLabel.numberOfLines=5; [title release]; [summary release]; If I try to NSLog the feed url in the loop cycle it was null! last question in this case how can I get the content? it is in a content key inside another content key! :S That's an example "title":"Home Page - La prova del cuoco", "id":"http://www.laprovadelcuoco.rai.it/", "updated":1350213485, "feed":[ { "href":"http://www.laprovadelcuoco.rai.it/dl/portali/site/page/Page-ffb545b4-9e72-41e5-866f-a465588c43fa-rss.html" } ], feed is different from title...
In the given example you will look for the first object containing the key "title". Which in the JSON is located at the first level of data. In order to get the value for the "items" you first need to parse that level of data then fetch the values you are interested in. The example below first fetches the items from the root level then goes through each of the keys, finding the title and the feed value. Hope this helps! NSArray *items = [[daParsare JSONValue] objectForKey:#"items"]; for (NSDictionary *item in items) { NSString *title = [item objectForKey:#"title"]; NSString *feed = [item valueForKeyPath:#"feed.href"]; }
I hope you get the array for key "items". Using the below code I get the following output: Code: NSArray *itemsDic=[jsonParsedObj objectForKey:#"items"]; NSArray *titles=[itemsDic valueForKey:#"title"]; To get the contents from "items" , use the following code NSArray *contents=[itemsDic valueForKeyPath:#"content.content"]; Output: ( Home Page - La prova del cuoco, Le prove Invalsi di matematica e italiano, A Prova di Mamma, prova - Wiktionary, Prova a prendermi - MYmovies, Prova a incastrarmi - MYmovies, Impariamo.info, Schede informative prova scritta di Ateneo - Ca' Foscari, Prova d'autore, Maturità, la terza prova scritta ma potrebbe essere l'ultima volta ... )
Insert missing comma (perl)
Line: výkonná produkce: Martin Scorsese, Timothy Van Patten střih: Kate Sanford, Tim Streeto herec(s): Hong Eun Hee (Mi Geum (soţia lui Sang Ok)) Han Hee (Jang Mi Ryung) Kim Yoo Mi (Yoon Chae Yeon) Jae-ho Song (Im Bong Hoek (tatăl lui Sang Ok)) I want insert, with perl, missing comma like this: výkonná produkce: Martin Scorsese, Timothy Van Patten střih: Kate Sanford, Tim Streeto herec(s): Hong Eun Hee (Mi Geum (soţia lui Sang Ok)), Han Hee (Jang Mi Ryung), Kim Yoo Mi (Yoon Chae Yeon), Jae-ho Song (Im Bong Hoek (tatăl lui Sang Ok)) Thanks.
Without any details on constraints, we have to guess what you need. I'm guessing this: s/\) /), /g