RDFHandlerBase overrides
972908
@Override
    public void handleNamespace(String prefix, String namespace) {
	if (prefix.equals("")) {
	    prefix = "def";
	}
	this.document.getNamespace().register(prefix, namespace);
	//pFactory.setNamespaces(this.document.getNss());
	//this.revnss.put(namespace, prefix);
    }
114114
@SuppressWarnings("rawtypes")
   public void setupConfigHandlers(Binding binding, CommonConfig config)
   {
      if (config != null) {
         //start with the use handlers only to remove the previously set configuration
         List<Handler> userHandlers = getNonConfigHandlers(binding.getHandlerChain());
         List<Handler> handlers = convertToHandlers(config.getPreHandlerChains(), binding.getBindingID(), true); //PRE
         handlers.addAll(userHandlers); //ENDPOINT
         handlers.addAll(convertToHandlers(config.getPostHandlerChains(), binding.getBindingID(), false)); //POST
         binding.setHandlerChain(handlers);
      }
   }
810358
private void addHandler(Object handler)
    {
        // Would be nice to have a better way to do this,
        // but the type information isn't preserved in the XML format anymore -
        // and the number of types of handler is pretty unlikely to change, so this list
        // won't have to be added to often, if at all.
        if (handler == null)
            return;

        if (handler instanceof IVideoProducer)
            addVideoProducer((IVideoProducer)handler);
        else if (handler instanceof IAudioProducer)
            addAudioProducer((IAudioProducer)handler);
        else if (handler instanceof ICommandHandler)
            addCommandHandler((ICommandHandler)handler);
        else if (handler instanceof IObservationProducer)
            addObservationProducer((IObservationProducer)handler);
        else if (handler instanceof IRewardProducer)
            addRewardProducer((IRewardProducer)handler);
        else if (handler instanceof IWorldGenerator)
            addWorldGenerator((IWorldGenerator)handler);
        else if (handler instanceof IWorldDecorator)
            addWorldDecorator((IWorldDecorator)handler);
        else if (handler instanceof IWantToQuit)
            addQuitProducer((IWantToQuit)handler);
        else
            this.failedHandlers += handler.getClass().getSimpleName() + " isn't of a recognised handler type.\n";
    }
568688
private void overrideUseMavenPatterns(T overrider, Class overriderClass) {
        if (useMavenPatternsOverrideList.contains(overriderClass.getSimpleName())) {
            try {
                Field useMavenPatternsField = overriderClass.getDeclaredField("useMavenPatterns");
                useMavenPatternsField.setAccessible(true);
                Object useMavenPatterns = useMavenPatternsField.get(overrider);

                if (useMavenPatterns == null) {
                    Field notM2CompatibleField = overriderClass.getDeclaredField("notM2Compatible");
                    notM2CompatibleField.setAccessible(true);
                    Object notM2Compatible = notM2CompatibleField.get(overrider);
                    if (notM2Compatible instanceof Boolean && notM2Compatible != null) {
                        useMavenPatternsField.set(overrider, !(Boolean)notM2Compatible);
                    }
                }
            } catch (NoSuchFieldException | IllegalAccessException e) {
                converterErrors.add(getConversionErrorMessage(overrider, e));
            }
        }
    }
371016
def rdf(dataset):
    ''''''
    format = RDF_EXTENSIONS[negociate_content()]
    url = url_for('datasets.rdf_format', dataset=dataset.id, format=format)
    return redirect(url)
61629
private void processPropertyOverride(PropertyMetadata propertyMetadata) {
    String qualifiedName = field.getQualifiedName() + "." + propertyMetadata.getField().getName();
    Property override = entityMetadata.getPropertyOverride(qualifiedName);
    if (override != null) {
      String mappedName = override.name();
      if (mappedName != null && mappedName.trim().length() > 0) {
        propertyMetadata.setMappedName(mappedName);
      }
      propertyMetadata.setIndexed(override.indexed());
      propertyMetadata.setOptional(override.optional());
    }
  }
973429
public ResultHandlerContext<DPO, RI, RO, RHI> handleWith(Collection<ResultHandler<RHI>> resultHandlers) {
        if (resultHandlers != null) {
            this.addedResultHandlers.addAll(resultHandlers);

            for (ResultHandler<RHI> resultHandler : resultHandlers) {
                builtValidator.addResultHandler(resultHandler);
            }
        }

        // Stay in the same context and re-use the same instance because no type has changed
        return this;
    }
1123576
public void registerHandler(String method, String url, OphApiHandler handler) {
		if (mtdHandler == null)
			mtdHandler = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);

		TreeMap<String, OphApiHandler> reg;
		if (method == null)
			method = "ALL";
		reg = mtdHandler.get(method);
		if (reg == null) {
			reg = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
			mtdHandler.put(method, reg);
		}
		reg.put(url, handler);
	}
1017885
def _bind(self, args, kwds):
    """"""
    bindings = dict(kwds)
    for i, arg in enumerate(args):
      bindings[i + 1] = arg
    used = {}
    ancestor = self.ancestor
    if isinstance(ancestor, ParameterizedThing):
      ancestor = ancestor.resolve(bindings, used)
    filters = self.filters
    if filters is not None:
      filters = filters.resolve(bindings, used)
    unused = []
    for i in xrange(1, 1 + len(args)):
      if i not in used:
        unused.append(i)
    if unused:
      raise datastore_errors.BadArgumentError(
          'Positional arguments %s were given but not used.' %
          ', '.join(str(i) for i in unused))
    return self.__class__(kind=self.kind, ancestor=ancestor,
                          filters=filters, orders=self.orders,
                          app=self.app, namespace=self.namespace,
                          default_options=self.default_options,
                          projection=self.projection, group_by=self.group_by)
1212433
def replace_uri(rdf, fromuri, touri):
    
    replace_subject(rdf, fromuri, touri)
    replace_predicate(rdf, fromuri, touri)
    replace_object(rdf, fromuri, touri)
10372
def _HandleLegacy(self, args, token=None):
    """"""

    # We only create generic hunts with /hunts/create requests.
    generic_hunt_args = rdf_hunts.GenericHuntArgs()
    generic_hunt_args.flow_runner_args.flow_name = args.flow_name
    generic_hunt_args.flow_args = args.flow_args

    # Clear all fields marked with HIDDEN, except for output_plugins - they are
    # marked HIDDEN, because we have a separate UI for them, not because they
    # shouldn't be shown to the user at all.
    #
    # TODO(user): Refactor the code to remove the HIDDEN label from
    # HuntRunnerArgs.output_plugins.
    args.hunt_runner_args.ClearFieldsWithLabel(
        rdf_structs.SemanticDescriptor.Labels.HIDDEN,
        exceptions="output_plugins")
    args.hunt_runner_args.hunt_name = standard.GenericHunt.__name__

    if args.original_hunt and args.original_flow:
      raise ValueError(
          "A hunt can't be a copy of a flow and a hunt at the same time.")
    if args.original_hunt:
      ref = rdf_hunts.FlowLikeObjectReference.FromHuntId(
          utils.SmartStr(args.original_hunt.hunt_id))
      args.hunt_runner_args.original_object = ref
    elif args.original_flow:
      ref = rdf_hunts.FlowLikeObjectReference.FromFlowIdAndClientId(
          utils.SmartStr(args.original_flow.flow_id),
          utils.SmartStr(args.original_flow.client_id))
      args.hunt_runner_args.original_object = ref

    # Anyone can create the hunt but it will be created in the paused
    # state. Permissions are required to actually start it.
    with implementation.StartHunt(
        runner_args=args.hunt_runner_args, args=generic_hunt_args,
        token=token) as hunt_obj:

      # Nothing really to do here - hunts are always created in the paused
      # state.
      logging.info("User %s created a new %s hunt (%s)", token.username,
                   hunt_obj.args.flow_runner_args.flow_name, hunt_obj.urn)

      return ApiHunt().InitFromAff4Object(hunt_obj, with_full_summary=True)
275620
private void overrideDeployerDetails(T overrider, Class overriderClass) {
        if (overrider instanceof DeployerOverrider) {
            try {
                Field deployerDetailsField = overriderClass.getDeclaredField("deployerDetails");
                deployerDetailsField.setAccessible(true);
                Object deployerDetails = deployerDetailsField.get(overrider);

                if (deployerDetails == null) {
                    Field oldDeployerDetailsField = overriderClass.getDeclaredField("details");
                    oldDeployerDetailsField.setAccessible(true);
                    Object oldDeployerDetails = oldDeployerDetailsField.get(overrider);
                    if (oldDeployerDetails != null) {
                        ServerDetails deployerServerDetails = createInitialDeployDetailsFromOldDeployDetails((ServerDetails) oldDeployerDetails);
                        deployerDetailsField.set(overrider, deployerServerDetails);
                    }
                }
            } catch (NoSuchFieldException | IllegalAccessException e) {
                converterErrors.add(getConversionErrorMessage(overrider, e));
            }
        }
    }
26432
function buildHandler(overrides) {
  const parseError = buildHandler.parseError;
  const buildError = buildHandler.buildError;

  /**
   * .
   */
  return function handler(error) {
    const found = parseError.apply(this, arguments);
    if (!found) {
      if (error instanceof Error) {
        Error.captureStackTrace(error, handler);
        throw error;
      }
      return sliced(arguments);
    }
    error = buildError.apply(this, found);
    if (notEmptyObject(overrides)) {
      Object.assign(error, overrides);
    }
    Error.captureStackTrace(error, handler);
    throw error;
  };
}
1181980
def rdfs_properties(rdf):
    """"""

    # find out the subproperty mappings
    superprops = {}  # key: property val: set([superprop1, superprop2..])
    for s, o in rdf.subject_objects(RDFS.subPropertyOf):
        superprops.setdefault(s, set())
        for sp in rdf.transitive_objects(s, RDFS.subPropertyOf):
            if sp != s:
                superprops[s].add(sp)

    # add the superproperty relationships
    for p, sps in superprops.items():
        logging.debug("setting superproperties: %s -> %s", p, str(sps))
        for s, o in rdf.subject_objects(p):
            for sp in sps:
                rdf.add((s, sp, o))
1314810
protected String determineDatabaseType() throws HandlerException {
        String dbName = null;
        try (Connection conn = getConnection()) {
            dbName = conn.getMetaData().getDatabaseProductName();
        } catch (SQLException e) {
            throw new HandlerException("Exception occured while getting DB Name",
                    DatabaseAuditHandler.class, e);
        }
        return dbName;
    }
689737
public void parseReplacedMethodSubElements(Element beanEle, MethodOverrides overrides) {
    NodeList nl = beanEle.getChildNodes();
    for (int i = 0; i < nl.getLength(); i++) {
      Node node = nl.item(i);
      if (node instanceof Element && nodeNameEquals(node, REPLACED_METHOD_ELEMENT)) {
        Element replacedMethodEle = (Element) node;
        String name = replacedMethodEle.getAttribute(NAME_ATTRIBUTE);
        String callback = replacedMethodEle.getAttribute(REPLACER_ATTRIBUTE);
        ReplaceOverride replaceOverride = new ReplaceOverride(name, callback);
        // Look for arg-type match elements.
        List<Element> argTypeEles = DomUtils.getChildElementsByTagName(replacedMethodEle, ARG_TYPE_ELEMENT);
        for (Element argTypeEle : argTypeEles) {
          replaceOverride.addTypeIdentifier(argTypeEle.getAttribute(ARG_TYPE_MATCH_ATTRIBUTE));
        }
        replaceOverride.setSource(extractSource(replacedMethodEle));
        overrides.addOverride(replaceOverride);
      }
    }
  }
551807
def AdjustDescriptor(self, fields):
    """"""

    for f in fields:
      if f.name == "args_rdf_name":
        f.name = "payload_type"

      if f.name == "args":
        f.name = "payload"

    return fields