...
Table of Contents | ||
---|---|---|
|
...
Overview
This page explores design issues for an efficient ORE ontology gem implementation based off the ActiveTriples framework.
Ontologies
The following is a list of all ontologies used by the Triple Examples.
Ontology Name | Prefix | URL | Details | Comments |
---|---|---|---|---|
RDF | rdf | http://www.w3.org/1999/02/22-rdf-syntax-ns# | specification | |
RDF Schema | rdfs | http://www.w3.org/2000/01/rdf-schema# | specification | |
Dublin Core | dc | http://purl.org/dc/elements/1.1/ | specification | |
ORE | ore | http://www.openarchives.org/ore/terms/ | specification | Represents both ordered and unordered items using the Aggregation class. |
IANA | iana | http://www.iana.org/assignments/relation/ | specification | ORE uses this ontology for first, last, next, and prev predicates. |
Friend of a Friend | foaf | http://xmlns.com/foaf/0.1 | specification | Uses ld4l-foaf_rdf gem. |
ORE Triples Examples
Code Block | ||||
---|---|---|---|---|
| ||||
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix iana: <http://www.iana.org/assignments/relation/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
<http://localhost:3000/individual/vc155> a ore:Aggregation ;
ore:aggregates <http://da-rdf.library.cornell.edu/individual/b3652730> ;
ore:aggregates <http://da-rdf.library.cornell.edu/individual/b3652234> ;
ore:aggregates <http://da-rdf.library.cornell.edu/individual/b3652543> ;
iana:first <http://localhost:3000/individual/vci162> ;
iana:last <http://localhost:3000/individual/vci164> ;
dc:title "My list" ;
dc:description "This is my list of references." .
<http://localhost:3000/individual/vci162> a ore:Proxy ;
ore:proxyFor <http://da-rdf.library.cornell.edu/individual/b3652730> ;
ore:proxyIn <http://localhost:3000/individual/vc155> ;
iana:next <http://localhost:3000/individual/vci163> .
<http://localhost:3000/individual/vci163> a ore:Proxy ;
ore:proxyFor <http://da-rdf.library.cornell.edu/individual/b3652234> ;
ore:proxyIn <http://localhost:3000/individual/vc155> ;
iana:prev <http://localhost:3000/individual/vci162> ;
iana:next <http://localhost:3000/individual/vci164> .
<http://localhost:3000/individual/vci164> a ore:Proxy ;
ore:proxyFor <http://da-rdf.library.cornell.edu/individual/b3652543> ;
ore:proxyIn <http://localhost:3000/individual/vc155> ;
iana:prev <http://localhost:3000/individual/vci163> . |
...
Data Structure Approaches
...
In-memory Data Structure | Pros | Cons | Comments |
---|---|---|---|
doubly linked list | + least amount of processing during fetch (probably not significant relative to overall processing required) | - iteration requires traversing next links | |
convert to array on fetch | + allows for fast access by position to loaded items | ||
convert to hash on fetch | + allows for fast fast access by proxy URI to loaded items | - iteration requires traversing next links | I anticipate the need to have direct access by proxy URI more than positional. |
Limit
...
testing for array in-memory data structure
Tests Test descriptions:
- array_create - use Array fill method to add array items with values from 0 to max_items
- array_move - use Array insert(to, delete_at(from)) to move an item from the end of the filled array to the beginning (worst case scenario)
- list_create - create a list header data structure and list item data structures with sample real world data using items[i]=item_info to add each item to the items array
- list_move - use Array insert(to,delete_at(from)) to move an item from the end of the filled array to the beginning AND update prev and next links
- list_find - use 0.upto(items.size-1) to check the value of items[i][:uri] to see if it matches the search value for uri - Test looks search for last item in list
...
Max Items | array_create | array_move | list_create | list_move | list_find_last | list_find_random | Comments | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Laptop | DEV VM | Laptop | DEV VM | Laptop (16Gb) | DEV VM (2Gb) | Laptop | DEV VM | Laptop | DEV VM | Laptop | DEV VM | ||
1,000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
10,000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
100,000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
500,000 | 0 | 0 | 0 | 0 | 1 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | |
1,000,000 | 0 | 0 | 0 | 0 | 4 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | |
2,000,000 | 0 | 0 | 0 | 0 | 11 | 13 | 0 | 0 | 0 | 0 | 0 | 0 | |
4,000,000 | 0 | 0 | 0 | 0 | 35 | OOM | 0 | OOM | 1 | OOM | 0 | OOM | |
8,000,000 | 1 | 1 | 0 | 0 | 115 | 0 | 2 | 0 | |||||
10,000,000 | 1 | 1 | 0 | 0 | 167 | 0 | 2 | 0 | |||||
20,000,000 | 1 | 2 | 0 | 0 | OOM | OOM | OOM | OOM | |||||
40,000,000 | 4 | 4 | 0 | 0 | |||||||||
80,000,000 | 6 | 8 | 0 | 0 | |||||||||
100,000,000 | 8 | 11 | 1 | 1 |
* Time measured in seconds
...