Loading Notation3 into the database

How did you parse and load the triples represented by the Notation3 file into the database? I am a little familiar with Jena and sesame seeds , but they seemed to be aimed at processing RDF or Turtle, and not the full Notation3.

I have found relatively few reliable tools for working with N3. The few that I have found are listed here and consist only of crude Python scripts that can only perform basic command-line actions and do not seem to have standard packaging, distribution, or maintenance. By default, the Python library looks like notation3.py , but I could not find a single home page for it and found dozens of different versions scattered across the Internet.

For example, let's say I have the following N3 representing a botanical classification:

 { [] :genus "Abies" ; :species "alba" ; :name [:value "Silver Fir" ; :usage "common" ; :language "English" ] ; :name [:value "European Silver Fir" ; :usage "common" ; :language "English" ] ; :name [:value "abeto blanco" ; :usage "common" ; :language "Spanish" ] ; :name [:value "abeto plateado" ; :usage "common" ; :language "Spanish" ] ; :name [:value "Edeltanne" ; :usage "common" ; :language "German" ] ; :name [:value "Silbertanne" ; :usage "common" ; :language "German" ] ; :name [:value "Wei&#xDF;tanne" ; :usage "common" ; :language "German" ] ; :stem!:type :erect ; :stem!:height [ :value!:start 30.0 ; :value!:end 50.0 ; :value!:units "m" ] ; :bark!:color :grey ; :bark!:ridges :irregular ; :foliage!:seasonality :evergreen ; :foliage!:type :needle ; :foliage!:arrangement :alternate ; :foliage!:length [ :value!:start 1.0 ; :value!:end 3.0 ; :value!:units "cm" ] ; :foliage!:width [ :value!:start 0.2 ; :value!:end 0.3 ; :value!:units "cm" ] ; :foliage!:color :green ; :foliage!:spiney :FALSE ; :flower [ :gender :male ; :inflorescence :catkin ; :sense :straight ; :color :brown ] ; :flower [ :gender :male ; :inflorescence :catkin ; :sense :straight ; :color :yellow ] ; :flower [ :gender :female ; :inflorescence :catkin ; :sense :straight ; :color :pink ] ; :fruit [ :kind :cone ; :color :brown ; ] ; } :is-a :botanical-classification ; :source [ :uri <http://originating/site> ; :name "John Doe" ; :data-collection-date "2005-01-01" ; ] ; :transcribed-by "Al Nonymous" ; :transcription-date "2010-09-01" . 

I want to load this (and potentially thousands of similar records) into a database so that I can run arbitrary queries such as "Who recorded records containing common Spanish names in 2010?" or "What is the average color of flowers associated with genus X?"

Is it practical to do this with current semantic web tools and N3?

+6
semantic-web rdf jena sesame n3
source share
1 answer

The main problem is that N3 has always been something of an experimental notation - the full language has never been widely implemented. The diagram in this document is quite informative: your sample uses graph literals, and they lie outside any of the widely implemented subsets of N3. Now that these graphs are more widely used, you could get the same information on most RDF systems, including Jena, but not by directly analyzing your input file.

If it were me, I would like to write the stage of transformation of the foreground, perhaps using a language suitable for strings and templates - for example, Ruby. You can then translate your input files into a form that standard RDF processors can handle. For example, a graph literal that denotes statements made by "Al Nonymous" can be converted to bNode, denoting the action of Al, approving this classification. In addition, you can extract each chart from its literal and save it to a file with the synthesized name of the chart, thereby preserving the structure of the nested graphs that you currently have. Likewise, the property!path notation could be easily rewritten into standard RDF due to a bit more verbose.

Alternatively, ask your data provider to provide you with a result that is in a more easily processed form!

+3
source share

All Articles