Gives the :provider_name associated with a provider's :rdf_subject
 (ie. :provider_id) in Solr, ignoring bnodes.

 @return [String]
182684
def initialize_name
      return nil unless valid_rdf_subject?
      query_params = { :rows => 1,
                       :q => rdf_subject,
                       :qf => 'provider_id',
                       :fl => 'provider_name provider_id' }
      response = Krikri::SolrResponseBuilder.new(query_params).response
      return nil unless response.docs.count > 0
      response.docs.first['provider_name'].respond_to?(:first) ?
        response.docs.first['provider_name'].first : rdf_subject
    end
1094588
def get_subject(self, subject_id):
        
        # subject_id could be a path such as '/user/j12y' so quote
        uri = self._get_subject_uri(guid=subject_id)
        return self.service._get(uri)
249585
def link_to_provider_page(provider)
      return link_to(provider_name(provider), providers_path) unless provider
      return link_to provider_name(provider),
              provider_path(provider.id, set_session: provider.id)
    end
643891
def connection
      @connection ||= self.class.connection_class.connect(
        url: config.solr.url,
        read_timeout: config.solr.read_timeout,
        open_timeout: config.solr.open_timeout,
        proxy: config.solr.proxy,
        update_format: config.solr.update_format || :xml
      )
    end
1097624
def get_provider_name(driver):
    
    kls = driver.__class__.__name__
    for d, prop in DRIVERS.items():
        if prop[1] == kls:
            return d
    return None
1311900
def query_params
      params = { :id => '*:*',
                 :sort => "random_#{rand(9999)} desc",
                 :rows => 1 }
      return params unless provider_id.present?

      provider = RDF::URI(Krikri::Provider.base_uri) / provider_id
      params[:fq] = "provider_id:\"#{provider}\""
      params
    end
737258
def get_provider_info(self, user_descriptor):
        
        route_values = {}
        if user_descriptor is not None:
            route_values['userDescriptor'] = self._serialize.url('user_descriptor', user_descriptor, 'str')
        response = self._send(http_method='GET',
                              location_id='1e377995-6fa2-4588-bd64-930186abdcfa',
                              version='5.0-preview.1',
                              route_values=route_values)
        return self._deserialize('GraphProviderInfo', response)
170684
def get_provider(self, name):
        """"""
        if name not in self.providers:
            cls = self.provider_classes[name]
            # instantiate the provider
            self.providers[name] = cls(self)
        return self.providers[name]
1273911
def _parse_subject(subject):
    '''
    
    '''
    ret = {}
    nids = []
    for nid_name, nid_num in six.iteritems(subject.nid):
        if nid_num in nids:
            continue
        try:
            val = getattr(subject, nid_name)
            if val:
                ret[nid_name] = val
                nids.append(nid_num)
        except TypeError as err:
            log.debug("Missing attribute '%s'. Error: %s", nid_name, err)

    return ret
1259463
def where_patterns(provider_uri)
      [[TYPE, RDF::EDM.provider, provider_uri],
       [TYPE, RDF.type, RDF::ORE.Aggregation]]
    end
338389
def entities(self, subject_id):
        
        try:
            return [i["entity_id"] for i in self._cache.find({"subject_id":
                    subject_id})]
        except ValueError:
            return []
951481
def delete!(headers = {})
      raise "Cannot delete #{rdf_subject}, does not exist." unless exist?
      headers['If-Match'] ||= etag
      response = make_request(:delete, nil, headers)
      @http_headers = nil
      response
    end
1042644
def get_subject_version(self, subject, version_id):
        
        res = requests.get(self._url('/subjects/{}/versions/{}', subject, version_id))
        raise_if_failed(res)
        return json.loads(res.json()['schema'])
1352630
def reload
      @rdf_subject ||= self.class.nr_uri_from_headers(http_head)
      response = get(nil, true)
      self.content_type = response.env.response_headers['content-type']
      self.content = response.env.body
      self
    end
845750
def replace_subject(rdf, fromuri, touri):
    
    if fromuri == touri:
        return
    for p, o in rdf.predicate_objects(fromuri):
        rdf.remove((fromuri, p, o))
        if touri is not None:
            if not isinstance(touri, (list, tuple)):
                touri = [touri]
            for uri in touri:
                rdf.add((uri, p, o))
386425
def lookup!(nameserver=nil)
      resolver = Resolv.resolver(nameserver)
      hosts = begin
                resolver.getnames(self.address.to_s)
              rescue
                []
              end

      hosts.map! do |name|
        HostName.first_or_create(
          :address => name,
          :ip_addresses => [self]
        )
      end

      return hosts
    end
707967
public static String nameHash(X500Principal subjectDN) {
        try {
            return hash(encodePrincipal(subjectDN));
        } catch (Exception e) {
            logger.error("", e);
            return null;
        }
    }