Class: NTriple
Overview
RDF triplet handling.
Instance Attribute Summary collapse
-
#about_uri ⇒ Object
readonly
Returns the value of attribute about_uri.
-
#predicat_uri ⇒ Object
readonly
Returns the value of attribute predicat_uri.
-
#value_litteral ⇒ Object
readonly
Returns the value of attribute value_litteral.
-
#value_uri ⇒ Object
readonly
Returns the value of attribute value_uri.
Instance Method Summary collapse
-
#compute_urialias(uri) ⇒ Object
Internal use.
-
#initialize ⇒ NTriple
constructor
Initialization of internal cache (performance enchancement).
-
#urialias(uri) ⇒ Object
Returns an aliases uri uri is in ntriple format: ‘<foo#bar>’ Optimize for ntriple file handling.
- #valueIsReference? ⇒ Boolean
Constructor Details
#initialize ⇒ NTriple
Initialization of internal cache (performance enchancement)
118 119 120 121 122 123 124 125 126 |
# File 'lib/ontomde-core/triplet.rb', line 118 def initialize # Le cache est remis à zéro à chaque fichier. # Les essais avec SID.nt montrent un gain de performance # de 10% sur la méthode urialias, les fichiers étant largement disjoints. #@@cacheUse=1 #@@cacheMiss=100 #log.debug "initialize triplet" @uriMappingCache=Hash.new(nil) end |
Instance Attribute Details
#about_uri ⇒ Object (readonly)
Returns the value of attribute about_uri.
113 114 115 |
# File 'lib/ontomde-core/triplet.rb', line 113 def about_uri @about_uri end |
#predicat_uri ⇒ Object (readonly)
Returns the value of attribute predicat_uri.
113 114 115 |
# File 'lib/ontomde-core/triplet.rb', line 113 def predicat_uri @predicat_uri end |
#value_litteral ⇒ Object (readonly)
Returns the value of attribute value_litteral.
113 114 115 |
# File 'lib/ontomde-core/triplet.rb', line 113 def value_litteral @value_litteral end |
#value_uri ⇒ Object (readonly)
Returns the value of attribute value_uri.
113 114 115 |
# File 'lib/ontomde-core/triplet.rb', line 113 def value_uri @value_uri end |
Instance Method Details
#compute_urialias(uri) ⇒ Object
Internal use
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/ontomde-core/triplet.rb', line 146 def compute_urialias(uri) #renvoi une uri apres avoir remplacer le chemin par son alias raise Warning.new,"Bad NT URI (#{uri})" if uri.nil? || (uri[0] != 60) #uri=uri[1,uri.length-2] #log.debug "uri[0,1] -> '#{uri[0,1]}'" uri=uri[1,uri.length].split(">",2)[0] #log.debug "uri-->#{uri}" return ::UriNamespace.instance.urialias(uri) #a=uri.split("#",2) #return uri if a[1].nil? #r=::UriNamespace.instance.getNamespaceAlias(a[0]) #log.debug "urialias="+r+"_"+a[1] #return r+"_"+a[1] #return "#{r}_#{a[1]}" end |
#urialias(uri) ⇒ Object
Returns an aliases uri uri is in ntriple format: ‘<foo#bar>’ Optimize for ntriple file handling
131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/ontomde-core/triplet.rb', line 131 def urialias(uri) #log.debug "#{uri} ??" #return nil if uri == nil ret=@uriMappingCache[uri] #log.debug "cache miss %=#{1.0*@@cacheMiss/@@cacheUse*100} cacheUse=#{@@cacheUse}" #@@cacheUse=@@cacheUse+1 return ret unless ret.nil? #log.debug "cache miss" #@@cacheMiss=@@cacheMiss+1 @uriMappingCache[uri]=ret=compute_urialias(uri) #log.debug "#{uri} -> #{ret}" return ret end |
#valueIsReference? ⇒ Boolean
114 115 |
# File 'lib/ontomde-core/triplet.rb', line 114 def valueIsReference? end |