Notes about schema for rdf / first lab
Allikas: Lambda
Some small notes which could be useful for importing geodata.
Our assumed input: ================= object property value <a1> <name> "john"^^string <a1> <country> "usa"^^string <a2> <neighbour> <a1> recommended structure for import: ================================= Three varchar fields as-is input data (obj, prop, val) plus metainfo of your choice (id is highly recommended). geo: id: autoincrement int (optionally ts: timestamp) (optionally status: char or boolean etc) (optionally even more metainfo fields) obj : varchar prop : varchar val : varchar alternatively could encode type as a separate column optionally could make a table for unique names, recommendation not to bother with this: names: id: autoincrement int name: <a1> and making the obj and prop columns int, values pointing to names table Querying ======== Example query for search by two fields: join needed for each condition: select obj from geo as geo1, geo as geo2 where geo1.prop='<name>' and geo1.val='"john"^^string' and geo2.prop='<country>' and geo2.val='"usa"^^string' and geo1.obj=geo2.obj Recommended: make a second table with json ========================================== A new table geojs like this: id object info <a1> {"<name>": ["john"^^string","pete"^^string], "<country>": ["usa"^^string"], "<neighbour>":["<a1>","usa"^^string"]} Populate by writing a program working over the first table. Worse alternative as an example: [["<name>","john"^^string], ["<name>","pete"^^string], ["<country>" "usa"^^string]]