summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrautenberg <rautenberg@in-silico.ch>2015-06-02 13:37:06 +0200
committerrautenberg <rautenberg@in-silico.ch>2015-06-02 13:37:06 +0200
commit61022ab95475774994f0152e78d1ab145d59dd32 (patch)
tree352c295c146a3fcc0d35f43c1571b5922c4ef783
parent388aba3e79f624dc3a38a3f1767c825dde9d7e1e (diff)
add some more syntax highlighting
-rw-r--r--_posts/2012-11-19-clever-feature-creation-keeps-your-database-small.md10
-rw-r--r--_posts/2015-03-09-edit-task-object-while-task-is-running.md4
2 files changed, 13 insertions, 1 deletions
diff --git a/_posts/2012-11-19-clever-feature-creation-keeps-your-database-small.md b/_posts/2012-11-19-clever-feature-creation-keeps-your-database-small.md
index 31504d1..76d1e88 100644
--- a/_posts/2012-11-19-clever-feature-creation-keeps-your-database-small.md
+++ b/_posts/2012-11-19-clever-feature-creation-keeps-your-database-small.md
@@ -15,28 +15,36 @@ Consider an `OpenTox::Dataset` object in its fully loaded (populated) state, con
However, even SPARQL queries take more time when data is stored in a redundant fashion at the 4Store service. This may not be necessary, since most of the data is usually already stored. For example, datasets, or parts of datasets, are often uploaded many times to the same service. Therefore, creating features by
+```ruby
f=OpenTox::Feature.new
... do something with f ...
f.put
+```
programmatically creates a new feature every time. The 4Store service knows nothing about the semantics and the programmer is in charge to tell the service that
+```ruby
f1=OpenTox::Feature.new
f1.title="Hamster Carcinogenicity"
f1.put
+```
and
+```ruby
f2=OpenTox::Feature.new
f2.title="Hamster Carcinogenicity"
f2.put
+```
are actually the same feature. He should *do this* instead:
+```ruby
f1=OpenTox::Feature.new
f1.title="Hamster Carcinogenicity"
f2=f1 # f2 is a pointer to f1
f1.put
+```
This results in a completely non-redundant setting, because compounds describing the same structure were already non-redundantly store. Therefore, two `OpenTox::Dataset`s describing the same data are now merely pointers to the same data. The features are also only present a single time at the 4Store backend.
@@ -47,6 +55,7 @@ The `opentox-client` library contains a method `OpenTox::Feature#find_by_title`
The method is used like this:
+```ruby
# Search feature by title
title = "Foo"
metadata = {
@@ -54,5 +63,6 @@ The method is used like this:
RDF::DC.description => description
}
feature = OpenTox::Feature.find_by_title(title, metadata)
+```
In practice, not many features are created per dataset, and the method works quite efficiently. It has very nice effects, for example, when uploading to datasets one after the other, both have identical features. The 4Store backend now knows that they are equal and potentially eliminates duplicate data.
diff --git a/_posts/2015-03-09-edit-task-object-while-task-is-running.md b/_posts/2015-03-09-edit-task-object-while-task-is-running.md
index 56e00c3..b176b82 100644
--- a/_posts/2015-03-09-edit-task-object-while-task-is-running.md
+++ b/_posts/2015-03-09-edit-task-object-while-task-is-running.md
@@ -9,7 +9,8 @@ tags: [Metadata, Object, RDF, Tutorials]
**This post explains how to edit a Task object with percentageCompleted value.**
_Example:_
-
+
+```ruby
# generate a Task uri
task_uri = OpenTox::Task.task_uri
@@ -37,6 +38,7 @@ _Example:_
end
# wait to complete
task.wait
+```
**If task status is completed task.percentageCompleted == 100%**