<commit_before>== IqRdf
IqRdf is a RDF renderer for Ruby and Rails. You can use it in any Ruby
environment to render Trurtle-, N-Triple- (not implemented jet) or XML-RDF.

IqRdf underlays a Builder-like (http://builder.rubyforge.org/) approach to specify
the RDF-Data by using a internal Ruby DSL. The basic Idea for specifing a triple
(subject, predicate, object) is that the predicate is a method call on the
subject with the object as parameters:

  IqRdf::some_subject.some_predicate(IqRdf::some_object)

The IqRdf namespaces are needed not to mess up the rest of your project due to
the heavy use of method_missing in the IqRdf-Library. See the IqRdf::use method
for Ruby 1.9 to omit the "IqRdf::" prefix.

=== Ruby example
You can use IqRdf in pure Ruby to produce Strings in a certain RDF Syntax like
Turtle or XML:
  require 'IqRdf'
  document = IqRdf::Document.new('http://www.test.de/')

  document.namespaces :skos => 'http://www.w3.org/2008/05/skos#',
    :foaf => 'http://xmlns.com/foaf/0.1/' # A :rdf namespace is added automatically

  document << IqRdf::john_doe.myCustomNote("This is an example", :lang => :en) 
  # Turtle: :john_doe :myCustomNote "This is an example"@en.

  document << IqRdf::john_doe(IqRdf::Foaf::build_uri("Person")).Foaf::name("<NAME>") 
  # Turtle: :john_doe a foaf:Person; foaf:name "<NAME>".

  document << IqRdf::john_doe.Foaf::knows(IqRdf::jane_doe)
  # Turtle: :john_doe foaf:knows :jane_doe.

  document.to_turtle
  # => "@prefix : <http://www.test.de/>. ..."

=== Rails example
Include IqRdf to your Ruby on Rails project by adding the following line to your
Gemfile (or with Rails 2.x in your config/environment.rb):
  gem "iq_rdf"
Add the mime types you want to support to your config/initializers/mime_types.rb
file:
  Mime::Type.register "application/rdf+xml", :rdf
  Mime::Type.register "text/turtle", :ttl
  Mime::Type.register "application/n-triples", :nt
Now you can define views in you application. Use the extension <em>.iqrdf</em>
for the view files. You can use the extensions <em>.ttl</em> or
<em>.rdf</em> in the URL of your request, to force the output to be
in Turtle or N-Triple.

==== The views
In your views IqRdf gives you a <em>document</em> object you can add your triples
to. But first you will have to define your namespaces and the global language if
you want to label all String literals in a certain language (as long as there is
no other language or <em>:none</em> given).
  document.namespaces :default => 'http://data.example.com/', :foaf => 'http://xmlns.com/foaf/0.1/'
  document.lang = :en

  document << IqRdf::test_subject.test_predicate("test")
  # Turtle: :test_subject :test_predicate "test"@en.

  document << IqRdf::test_subject.test_predicate("test", :lang => :de)
  # Turtle: :test_subject :test_predicate "test"@de.


  document << IqRdf::test_subject.test_predicate("test", :lang => :none)
  # Turtle: :test_subject :test_predicate "test".

  ...

Use the namespace token <em>:default</em> to mark the default namespace. This has the
same effect as specifing the default namespace in IqRdf::Document.new.

=== Complex RDF definitions
...

Copyright (c) 2011 <NAME> (innoQ Deutschland GmbH), released under the Apache License 2.0
<commit_msg>Fixed documentation<commit_after>== IqRdf
IqRdf is a RDF renderer for Ruby and Rails. You can use it in any Ruby
environment to render Trurtle-, N-Triple- (not implemented jet) or XML-RDF.

IqRdf underlays a Builder-like (http://builder.rubyforge.org/) approach to specify
the RDF-Data by using a internal Ruby DSL. The basic Idea for specifing a triple
(subject, predicate, object) is that the predicate is a method call on the
subject with the object as parameters:

  IqRdf::some_subject.some_predicate(IqRdf::some_object)

The IqRdf namespaces are needed not to mess up the rest of your project due to
the heavy use of method_missing in the IqRdf-Library. See the IqRdf::use method
for Ruby 1.9 to omit the "IqRdf::" prefix.

=== Ruby example
You can use IqRdf in pure Ruby to produce Strings in a certain RDF Syntax like
Turtle or XML:
  require 'IqRdf'
  document = IqRdf::Document.new('http://www.test.de/')

  document.namespaces :skos => 'http://www.w3.org/2008/05/skos#',
    :foaf => 'http://xmlns.com/foaf/0.1/' # A :rdf namespace is added automatically

  document << IqRdf::john_doe.myCustomNote("This is an example", :lang => :en) 
  # Turtle: :john_doe :myCustomNote "This is an example"@en.

  document << IqRdf::john_doe(IqRdf::Foaf::build_uri("Person")).Foaf::name("<NAME>") 
  # Turtle: :john_doe a foaf:Person; foaf:name "<NAME>".

  document << IqRdf::john_doe.Foaf::knows(IqRdf::jane_doe)
  # Turtle: :john_doe foaf:knows :jane_doe.

  document.to_turtle
  # => "@prefix : <http://www.test.de/>. ..."

=== Rails example
Include IqRdf to your Ruby on Rails project by adding the following line to your
Gemfile (or with Rails 2.x in your config/environment.rb):
  gem "iq_rdf"
Add the mime types you want to support to your config/initializers/mime_types.rb
file:
  Mime::Type.register "application/rdf+xml", :rdf
  Mime::Type.register "text/turtle", :ttl
  Mime::Type.register "application/n-triples", :nt
Now you can define views in you application. Use the extension <em>.iqrdf</em>
for the view files. You can use the extensions <em>.ttl</em> or
<em>.rdf</em> in the URL of your request, to force the output to be
in Turtle or XML/RDF.

==== The views
In your views IqRdf gives you a <em>document</em> object you can add your triples
to. But first you will have to define your namespaces and the global language if
you want to label all String literals in a certain language (as long as there is
no other language or <em>:none</em> given).
  document.namespaces :default => 'http://data.example.com/', :foaf => 'http://xmlns.com/foaf/0.1/'
  document.lang = :en

  document << IqRdf::test_subject.test_predicate("test")
  # Turtle: :test_subject :test_predicate "test"@en.

  document << IqRdf::test_subject.test_predicate("test", :lang => :de)
  # Turtle: :test_subject :test_predicate "test"@de.


  document << IqRdf::test_subject.test_predicate("test", :lang => :none)
  # Turtle: :test_subject :test_predicate "test".

  ...

Use the namespace token <em>:default</em> to mark the default namespace. This has the
same effect as specifing the default namespace in IqRdf::Document.new.

=== Complex RDF definitions
...

Copyright (c) 2011 <NAME> (innoQ Deutschland GmbH), released under the Apache License 2.0

{'fraction_non_alphanumeric': 0.12088421703509043, 'fraction_numerical': 0.006183335909723296, 'mean_word_length': 4.355960264900662, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3128239', 'n_tokens_mistral': 2288, 'n_tokens_neox': 2175, 'n_words': 765}