1 / 20

Ceri Binding Hypermedia Research Unit, University of Glamorgan, Wales

Ceri Binding Hypermedia Research Unit, University of Glamorgan, Wales http://hypermedia.research.glam.ac.uk/kos/STELLAR/. STELLAR Data Conversions. SQL2CSV SQL2TAB. SQLEXECUTE. Delimited Data. Database. CSV2DB TAB2DB. CSV2STG TAB2STG DELIM2STG. SQL2STG. User-defined template. XML.

walden
Download Presentation

Ceri Binding Hypermedia Research Unit, University of Glamorgan, Wales

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ceri Binding Hypermedia Research Unit, University of Glamorgan, Wales http://hypermedia.research.glam.ac.uk/kos/STELLAR/

  2. STELLAR Data Conversions SQL2CSV SQL2TAB SQLEXECUTE Delimited Data Database CSV2DB TAB2DB CSV2STG TAB2STG DELIM2STG SQL2STG User-defined template XML RDF [other textual formats]

  3. User Defined Templates • STELLAR uses the “StringTemplate” engine http://www.stringtemplate.org/ • String Template Group - text files (*.stg) • Textual templates with named placeholders, populated by data at runtime • User defined vs. inbuilt templates: • Advantage - more flexibility in output format  • Disadvantage - no validation of output format 

  4. String Template Group – layout • Delimiters • Define characters that will be used to identify start & end of named placeholders within the template • Imports • Import externally defined templates • Dictionaries • Define lookup dictionaries • Templates • Define templates

  5. String Template Group - example // Define delimiters (if not defined, default is "$") delimiters "$", "$" // Import external templates (allows template libraries) import "myGroup.stg" // Define a lookup dictionary. Usage: my_dictionary.(“EBA”) my_dictionary ::= [ "EBA" : "Early Bronze Age", "MBA" : "Middle Bronze Age", "LBA" : "Late Bronze Age", default : key // Unknown value passed through ] // Define a template my_template1(period) ::= "Period is $my_dictionary.(period)$" // e.g. my_template("EBA")$ => "Period is Early Bronze Age"

  6. STELLAR-Specific Templates • STELLAR.Console looks for 3 key templates: HEADER, RECORD & FOOTER delimiters "$", "$" // define delimiter character to use for data ‘placeholders’ import "MyTemplates.stg" // import to use templates held in other *.stg files // 1. HEADER is written first (if the template exists) HEADER(options) ::= "List of $options.site_name$ finds" // 2. RECORD is written once per row of input data RECORD(options, data) ::= << Find Number : $data.id$ // “id” here is the column name from the input data Find Type : $data.type$// the placeholders get replaced by the actual data values Description : $data.desc$ $write_some_stars()$ // example of calling another user defined template >> // 3. FOOTER is written last (if the template exists) FOOTER(options) ::= "End of list" // other templates can be defined and called from main templates write_some_stars() ::= "*************"

  7. Example template input & output (delimited CSV data input): id, type, desc 12345, ”hobnail”, ”Rusted nail shaft, possibly a hobnail?” 23456, ”brooch”, ”Gold brooch with inlaid mother of pearl” 34567, ”cleat”, “Heavily corroded” (template output): List of South Downs finds Find Number : 12345 Find Type : hobnail Description : Rusted nail shaft, possibly a hobnail? ************* Find Number : 23456 Find Type : brooch Description : Gold brooch with inlaid mother of pearl ************* Find Number : 34567 Find Type : cleat Description : Heavily corroded ************* End of list (HEADER) “List of $options.site_name$ finds” (RECORD) Find Number : $data.id$ Find Type : $data.type$ Description : $data.desc$ write_some_stars() (write_some_stars) “*************” (FOOTER) “End of list”

  8. Using templates to produce RDF delimiters "$", "$” // write RDF header HEADER(options) ::= << <?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> >> // write RDF entities and properties based on each data row RECORD(options, data) ::= << <rdf:Description rdf:about="http://tmp/$data.id$"> <rdfs:label>$data.title$</rdfs:label> </rdf:Description> >> // write RDF footer – closure of RDF element from header FOOTER(options) ::= "</rdf:RDF>"

  9. Template Dependencies RDF.stg Imports CRM.stg Imports CRMEH.stg Imports Imports Imports CRMEH_GROUPS.stg CRMEH_CONTEXTS.stg CRMEH_Etc.

  10. User Defined Template Fields

  11. Consistent URIs - Convention • Namespace prefix • E.g. “http://stellar/silchester/” • Entity type • E.g. “EHE0007” (i.e. Context) • Identifier (data value) • E.g. “1015” • URI pattern: {prefix}{entity type}_{value} • E.g. “http://stellar/silchester/EHE0007_1015” • Consistent identifiers facilitate incremental enrichment of data

  12. CRM-EH entity / CRM property chain • Context A stratigraphically below Context B: • crmeh:EHE0007_Context [EHE0007_A] • crm:P7i_witnessed • crmeh:EHE1001_ContextEvent [EHE1001_A] • crm:P120_occurs_before • crmeh:EHE1001_ContextEvent [EHE1001_B] • crm:P7_took_place_at • crmeh:EHE0007_Context [EHE0007_B]

  13. Example: CRMEH_CONTEXTS: strat_lower_id crmeh:EHE0007_Context data:EHE0007_123 Example template input ecrm:P7i_witnessed ecrm:P7_took_place_at crmeh:EHE1001_ContextEvent data:EHE1001_123 ecrm:P120i_occurs_after ecrm:P120_occurs_before crmeh:EHE1001_ContextEvent data:EHE1001_456 ecrm:P7_took_place_at ecrm:P7i_witnessed crmeh:EHE0007_Context data:EHE0007_456 Resultant template output Data model

  14. Browsing RDF Data (“Gruff” tool) • Import, consolidation, browsing & querying of RDF data

  15. Querying RDF Data - SPARQL • Structured semantic queries • Similar(ish) syntax to SQL • Use same query across multiple datasets • Possibly develop templates to build queries?

  16. XML encoding / URL Encoding / MD5 encoding Body text

  17. Issues Validation of output Versioning of templates

  18. STELLAR.Win

  19. Ceri Binding Hypermedia Research Unit, University of Glamorgan, Wales http://hypermedia.research.glam.ac.uk/kos/STELLAR/

More Related