Sha256: fccc2d1a97a7d89627f568c968672ba5e1acd9828a6c41262bbe44a602ecbbb3

Contents?: true

Size: 894 Bytes

Versions: 4

Compression:

Stored size: 894 Bytes

Contents

module Spread2RDF
  module Mapping
    module Statement

      def statements_to_object(object)
        case schema.statement_mapping_mode
          when :default
            if schema.inverse_mode
              statement(object, predicate, subject)
            else
              statement(subject, predicate, object)
            end
          when :restriction
            raise NotImplementedError if schema.inverse_mode
            restriction_class = RDF::Node.new
            statements(
                [ subject, RDF::RDFS.subClassOf, restriction_class ],
                [ restriction_class, RDF.type, RDF::OWL.Restriction ],
                [ restriction_class, RDF::OWL.onProperty, predicate ],
                [ restriction_class, schema.restriction_mode, object ]
            )
        end
      end
      private :statements_to_object
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spread2rdf-0.1.7 lib/spread2rdf/mapping/statement.rb
spread2rdf-0.1.6 lib/spread2rdf/mapping/statement.rb
spread2rdf-0.1.5 lib/spread2rdf/mapping/statement.rb
spread2rdf-0.1.4 lib/spread2rdf/mapping/statement.rb