Friday 16 January 2015

Using the rOntorion package in R / RStudio and Fluent Editor

The rOntorion package is the port of Cognitum's Semantic Technologies to R. R has become an important tool among Statisticians and Data Scientists and we are proud to provide this community with an enhanced Linked-Data manipulation experience that will allow them to edit, store and reason over structured data (in the supported formats ocnl, rdf and owl); henceforth discovering new horizons in Data Analysis. rOntorion allows to extend Fluent Editor in R and in turn provides the users with the capability of creating their own custom functionality.

rOntorion in R

To demonstrate the use of rOntorion directly from R, let us go through a minimal example. In this example we are going to reason over a set of dummy sentences and infer a single logical conclusion by querying the semantic engine with a question expressed in ocnl format. First we need to install rOntorion: to do so, issue the following command in an R Console:


> options(repos = c(CRAN='http://cran.r-project.org', COGNITUM='http://downloads.cognitum.eu/packages'))

Now you can install rOntorion using the install.packages R function:

 > install.packages("rOntorion", NULL, repos = getOption("repos"), type="source")

Once rOntorion is properly installed, create a new script in R with the following content:
 
library(rOntorion)
str <- paste("If a mouse likes a cat then the mouse greets the cat.",
           "Kitty is a cat.", 
           "Mickey is mouse.", 
           "Mickey likes Kitty.", sep="\n")
 
onto<-ontorion.load.cnl.string(str, FALSE) 
ontorion.instances.of(onto,"something that greets a cat")
#Result: [1] "Mickey"
You can learn more about the grammar used in this example at CNL Grammar. For your convenience, you can navigate the help contents of rOntorion in RStudio.



Alternatively you can use the "help(rOntorion)" command in an R console after loading the rOntorion library.

rOntorion in Fluent Editor

Fluent Editor ships with 2 built-in R plugins. This plugins are found under the Tools ribbon:


To assess the value of the provided functionality, let us go through a couple of examples. In Fluent Editor, open the "African WildLife" template by clicking in File → African Wildlife. Once the ontology is loaded, click on the "Draw Ontology Graph". After clicking, the Fluent Editor visual interface will mutate to the state shown below:


The R Output window will display any textual results from the computation and the status icon in the status bar of Fluent Editor will show the state of the R engine computation. In this moment the request is being performed asynchronously. Once the results of the computation are ready, a graph will be displayed:


This graph outlines the different relationships among entities in the ontology. For the demonstration of the second plugin, click on the "Enumerate Universe" icon; this plugin provides a textual enumeration of concepts and instances in the ontology, including a description of all instances that features the list of the concepts from which each instance inherits its properties. This plugin is also a sample of R editing functionality as shown in the screenshot below where the plugin has added a comment (hightlighted in red) to the current editor:


If you want to learn more about Fluent Editor 2014 R2, visit this link.



*) FluentEditor 2014 R2, ontology editor, is a comprehensive tool for editing and manipulating complex ontologies that uses Controlled Natural Language. Fluent editor provides one with a more suitable for human users alternative to XML-based OWL editors. It's main feature is the usage of Controlled English as a knowledge modeling language. Supported via Predictive Editor, it prohibits user from entering any sentence that is grammatically or morphologically incorrect and actively helps the user during sentence writing. 

17 comments:

  1. Unable to load the rOntorion library. Here are my results after running install.packages:

    > install.packages("rOntorion", NULL, repos = getOption("repos"), type="source")
    Warning in install.packages :
    cannot open: HTTP status was '404 The specified blob does not exist.'
    Warning in install.packages :
    cannot open: HTTP status was '404 The specified blob does not exist.'
    Warning in install.packages :
    unable to access index for repository http://downloads.cognitum.eu/packages/bin/macosx/mavericks/contrib/3.1
    trying URL 'http://downloads.cognitum.eu/packages/src/contrib/rOntorion_0.1-4.tar.gz'
    Content type 'application/x-gzip' length 40767985 bytes (38.9 Mb)
    opened URL
    ==================================================
    downloaded 38.9 Mb

    * installing *source* package ‘rOntorion’ ...
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    Warning: /private/var/folders/_6/zzjtvp4d6jb1ynhmp2b775wh0000gn/T/RtmpRBfHtL/R.INSTALL104621ce2181/rOntorion/man/ontorion.load.cnl.file.Rd:20: unknown macro '\item'
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    Error : .onLoad failed in loadNamespace() for 'rOntorion', details:
    call: NULL
    error: package ‘rClr’ was built for x86_64-w64-mingw32
    Error: loading failed
    Execution halted
    ERROR: loading failed
    * removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rOntorion’
    Warning in install.packages :
    installation of package ‘rOntorion’ had non-zero exit status

    The downloaded source packages are in
    ‘/private/var/folders/_6/zzjtvp4d6jb1ynhmp2b775wh0000gn/T/RtmpbiD0ux/downloaded_packages’

    ReplyDelete
  2. Hi Chip,

    Unfortunately, we are not supporting OSX yet. Please stay tuned, since we are working on a viable port.

    ReplyDelete
  3. I am staying tuned looking forward to the port.

    ReplyDelete
  4. not able to install the above package
    showing the error
    Installing package into ‘C:/Users/INDIA/Documents/R/win-library/3.4’
    (as ‘lib’ is unspecified)
    Warning: unable to access index for repository http:\cran.r-project.org/src/contrib:
    scheme not supported in URL 'http:\cran.r-project.org/src/contrib/PACKAGES'
    Warning: unable to access index for repository http:\downloads.cognitum.eu/packages/src/contrib:
    scheme not supported in URL 'http:\downloads.cognitum.eu/packages/src/contrib/PACKAGES'
    Warning message:
    package ‘rOntorion’ is not available (for R version 3.4.0)

    ReplyDelete
  5. not able to install the above package
    showing the error
    Installing package into ‘C:/Users/INDIA/Documents/R/win-library/3.4’
    (as ‘lib’ is unspecified)
    Warning: unable to access index for repository http:\cran.r-project.org/src/contrib:
    scheme not supported in URL 'http:\cran.r-project.org/src/contrib/PACKAGES'
    Warning: unable to access index for repository http:\downloads.cognitum.eu/packages/src/contrib:
    scheme not supported in URL 'http:\downloads.cognitum.eu/packages/src/contrib/PACKAGES'
    Warning message:
    package ‘rOntorion’ is not available (for R version 3.4.0)

    ReplyDelete
  6. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details. rprogramming training in bangalore

    ReplyDelete
  7. Model due ingenuity report on M&A exchanges. This DD report is for M&A due perseverance gives a rundown of inquiries to be replied before close. A due constancy report is sent as an inside notice to individuals from the official group who are assessing the exchange and is a necessity for finalizing the negotiations.For more detail due diligence report please visit websites.

    ReplyDelete
  8. virginia cosmetic dentistry is the term used to depict the methodology that improves the presence of the individual's teeth. It incorporates the treatment of the teeth's shading,

    ReplyDelete
  9. This was nice and amazing and the given contents were very useful and the precision has given here is good.

    Hadoop Training Institute in Pune
    Hadoop Administration training institutes in Pune

    ReplyDelete
  10. Thanks for Sharing a Very Informative Post & I read Your Article & I must say that is very helpful post for us.
    Data Science Course in Pune
    Python Classes in Pune
    Best AWS Training in Pune

    ReplyDelete
  11. Investing Secne is the right resource to help traders find the best brokers, strategies and investment news online. We offer content marketing services, reviews, trading charts, and industry news so you can find what you're looking for quickly. Investing Secne is a portal created for traders, to help them find the best brokers and strategies online on a single platform.

    ReplyDelete
  12. Live Forex Trading Help You Choose Between The Hundreds Of Forex Brokers In The Market. We Know How Tough It Is To Try And Compare Different Websites, While Also Hoping They Are Good Brokers. But That Worry Gets Brighter When You Start Comparing Their Trading Conditions, Spreads, And Deposit Bonuses. That's Why We Are Here To Help You Make That Very Important Decision By Doing All Our Research Easily Organized By A Series Of Checklists. We Hope It Will Inspire You To Start Trading Forex Online.

    ReplyDelete
  13. Get all of the verb Stocktwits Updates you need to succeed in investing and trading on the Live, Real-Time Stock Market Overview. Be one of the first to know if verb Stocktwits has increased in value or if other stocks are trending up or down. Live notifications will tell you about all of these things in a clear and concise manner so that you can make the right decisions on your next investment in verb Stocktwits.

    ReplyDelete
  14. Looking for a foundation repair Edmonton? Look no further than Rammafoundation. We're a Edmonton foundation repair company that has been repairing foundations and building decks since 1978. We use the latest technology and equipment to get your foundation repaired quickly and efficiently. We also offer a 100% satisfaction guarantee on all of our work, so you can be sure you're getting the best possible service. Give us a call today to get started!

    ReplyDelete
  15. You can rely on us for high-quality design. Our talented Digital Marketing Services can help you create the perfect logo today.

    ReplyDelete
  16. Be among the first to discover whether the value of word Stocktwits has increased or whether other stocks are moving higher or lower. You will be able to make informed judgments regarding your next verb Stocktwits bitlife investment by using live notifications, which will provide you with clear and simple information about all of these topics.

    ReplyDelete