rdf_to_graphviz 0.0.0.1 → 0.0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/rdf_to_graphviz.rb +17 -13
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e153763d8ffb47a7292915cca57d46a320c52a8a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 4de8d1e305374b82789226e6784a402c907bfeef
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 047fa2f6c1aad66596007e3a4919883603f5814447e3dc04103f6effc4a6a4ee2c2f48b86f5e75808305624e56159c18fc9cb13c0f3547c58568703e3b216b02
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 309aa185510f6977bcafbf96e1f40722c59899fe3c52c1512c3f6c336fe4d0e5b1e6f840cc9f5e1d9288e47e0c7de6b16aa7ed9e302ff8d6cfcde479f78af900
         
     | 
    
        data/lib/rdf_to_graphviz.rb
    CHANGED
    
    | 
         @@ -17,20 +17,24 @@ class RdfToGraphviz 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
            	end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
            	 
     | 
| 
       21 
     | 
    
         
            -
            	# + 
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                # 
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
            	##
         
     | 
| 
      
 21 
     | 
    
         
            +
            	# +rdf_graph_to_dot(options = {})+ generate simple dot graph from RDF::Graph
         
     | 
| 
      
 22 
     | 
    
         
            +
            	#  @option options [RDF::Graph] :rdf_graph
         
     | 
| 
      
 23 
     | 
    
         
            +
            	#  @option options [TrueClass]  :digraph - if true, graph has a direction - true is default
         
     | 
| 
      
 24 
     | 
    
         
            +
            	#  @option options [String]     :subject_shape - default = doublecircle
         
     | 
| 
      
 25 
     | 
    
         
            +
            	#  @option options [String]     :object_shape - default = circle
         
     | 
| 
      
 26 
     | 
    
         
            +
            	#  @option options [String]     :literal_object_shape - default = rectangle
         
     | 
| 
      
 27 
     | 
    
         
            +
            	#  @return [String] - contain representation of RDF::Graph in Graphviz dot 
         
     | 
| 
      
 28 
     | 
    
         
            +
                #
         
     | 
| 
       30 
29 
     | 
    
         
             
            	def rdf_graph_to_dot(options = {})
         
     | 
| 
       31 
30 
     | 
    
         
             
            		txt_dot = ""
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
       32 
32 
     | 
    
         
             
            		options[:rdf_graph] ||= @graph
         
     | 
| 
       33 
33 
     | 
    
         
             
            		options[:digraph] ||= true
         
     | 
| 
      
 34 
     | 
    
         
            +
            		options[:subject_shape] ||= "doublecircle"
         
     | 
| 
      
 35 
     | 
    
         
            +
            		options[:object_shape] ||= "circle"
         
     | 
| 
      
 36 
     | 
    
         
            +
            		options[:literal_object_shape] ||= "rectangle"
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
       34 
38 
     | 
    
         
             
            		if options[:digraph] == true
         
     | 
| 
       35 
39 
     | 
    
         
             
            			txt_dot << "\ndigraph digraph_1 {"
         
     | 
| 
       36 
40 
     | 
    
         
             
            		else
         
     | 
| 
         @@ -42,11 +46,11 @@ class RdfToGraphviz 
     | 
|
| 
       42 
46 
     | 
    
         
             
            			s = term_name(statement[0])
         
     | 
| 
       43 
47 
     | 
    
         
             
            			o =  term_name(statement[2])
         
     | 
| 
       44 
48 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
            			txt_dot << "\n\"#{s}\"[color=red, shape 
     | 
| 
      
 49 
     | 
    
         
            +
            			txt_dot << "\n\"#{s}\"[color=red, shape=#{options[:subject_shape]}];"
         
     | 
| 
       46 
50 
     | 
    
         
             
            			if statement[2].literal?
         
     | 
| 
       47 
     | 
    
         
            -
            				txt_dot << "\n\"#{o}\"[shape 
     | 
| 
      
 51 
     | 
    
         
            +
            				txt_dot << "\n\"#{o}\"[shape=#{options[:literal_object_shape]}];"
         
     | 
| 
       48 
52 
     | 
    
         
             
            			else
         
     | 
| 
       49 
     | 
    
         
            -
            				txt_dot << "\n\"#{o}\"[color=blue, shape 
     | 
| 
      
 53 
     | 
    
         
            +
            				txt_dot << "\n\"#{o}\"[color=blue, shape=#{options[:object_shape]}];"
         
     | 
| 
       50 
54 
     | 
    
         
             
            			end
         
     | 
| 
       51 
55 
     | 
    
         
             
            			txt_dot << "\n\"#{s}\" -> \"#{o}\" [label=\"#{statement[1].pname}\", color=red];"
         
     | 
| 
       52 
56 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: rdf_to_graphviz
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.0.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - WiDu
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-04-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: linkeddata
         
     |