Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ceri Binding Hypermedia Research Unit, University of Glamorgan, Wales

Similar presentations


Presentation on theme: "Ceri Binding Hypermedia Research Unit, University of Glamorgan, Wales"— Presentation transcript:

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

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

3 User Defined Templates  STELLAR uses the “StringTemplate” engine http://www.stringtemplate.org/ 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.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() ::= "*************" STELLAR-Specific Templates

7 (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” (HEADER) “List of $options.site_name$ finds” (RECORD) Find Number : $data.id$ Find Type : $data.type$ Description : $data.desc$ write_some_stars() (RECORD) Find Number : $data.id$ Find Type : $data.type$ Description : $data.desc$ write_some_stars() (FOOTER) “End of list” (FOOTER) “End of list” (write_some_stars) “*************” (write_some_stars) “*************” Example template input & output

8 delimiters "$", "$” // write RDF header HEADER(options) ::= << >> // write RDF entities and properties based on each data row RECORD(options, data) ::= << $data.title$ >> // write RDF footer – closure of RDF element from header FOOTER(options) ::= " " Using templates to produce RDF

9 Template Dependencies RDF.stg CRM.stg CRMEH.stg CRMEH_GROUPS.stgCRMEH_CONTEXTS.stgCRMEH_Etc. Imports

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 ecrm:P7_took_place_at ecrm:P120i_occurs_after crmeh:EHE1001_ContextEvent data:EHE1001_123 crmeh:EHE1001_ContextEvent data:EHE1001_123 ecrm:P7_took_place_atecrm:P7i_witnessed crmeh:EHE1001_ContextEvent data:EHE1001_456 crmeh:EHE1001_ContextEvent data:EHE1001_456 ecrm:P7i_witnessed ecrm:P120_occurs_before crmeh:EHE0007_Context data:EHE0007_123 crmeh:EHE0007_Context data:EHE0007_123 crmeh:EHE0007_Context data:EHE0007_456 crmeh:EHE0007_Context data:EHE0007_456 Example: CRMEH_CONTEXTS: strat_lower_id Resultant template output Example template input Data model

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

15

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

17 XML encoding / URL Encoding / MD5 encoding Body text

18 Issues Validation of output Versioning of templates

19 STELLAR.Win

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


Download ppt "Ceri Binding Hypermedia Research Unit, University of Glamorgan, Wales"

Similar presentations


Ads by Google