Set up annotation metadata
179940
private function setupAnnotationMetadata()
    {
        $annotationFiles = $this->getOption('annotation_files');
        if ($annotationFiles) {
            if (!is_array($annotationFiles)) {
                $annotationFiles = [$annotationFiles];
            }

            foreach ($annotationFiles as $file) {
                AnnotationRegistry::registerFile($file);
            }
        }

        $annotationNamespaces = $this->getOption('annotation_namespaces');
        if ($annotationNamespaces) {
            if (!is_array($annotationNamespaces)) {
                $annotationNamespaces = [$annotationNamespaces];
            }

            AnnotationRegistry::registerAutoloadNamespaces($annotationNamespaces);
        }

        $annotationAuloaders = $this->getOption('annotation_autoloaders');
        if ($annotationAuloaders) {
            if (!is_array($annotationAuloaders)) {
                $annotationAuloaders = [$annotationAuloaders];
            }

            foreach ($annotationAuloaders as $autoloader) {
                AnnotationRegistry::registerLoader($autoloader);
            }
        }
    }
577984
private function setDoctrine(): void
    {
        $config        = Setup::createAnnotationMetadataConfiguration([], true, null, null, false);
        $entityManager = EntityManager::create([
            'driver'   => $this->config('DSN'),
            'user'     => $this->config('user'),
            'password' => $this->config('password'),
            'dbname'   => $this->config('name'),
        ], $config);

        $this->container()->set('db', $entityManager, 'raw');
    }
791783
@Inject
    public void setup(ViewConfigExtension extension) {
        for (Entry<String, Set<Annotation>> e : extension.getData().entrySet()) {
            for (Annotation i : e.getValue()) {
                addAnnotationData(e.getKey(), i);
            }
        }
    }
800242
def _set_annotation_to_str(annotation_data: Mapping[str, Mapping[str, bool]], key: str) -> str:
    """"""
    value = annotation_data[key]

    if len(value) == 1:
        return 'SET {} = "{}"'.format(key, list(value)[0])

    x = ('"{}"'.format(v) for v in sorted(value))

    return 'SET {} = {{{}}}'.format(key, ', '.join(x))
1200006
def _init_metadata(self, **kwargs):
        """"""
        osid_objects.OsidObjectForm._init_metadata(self, **kwargs)
        self._courses_default = self._mdata['courses']['default_id_values']
        self._assessments_default = self._mdata['assessments']['default_id_values']
        self._assets_default = self._mdata['assets']['default_id_values']
1085797
def add_annotation(self, entity, annotation, value):
        '''  '''
        url = self.base_path + 'term/add-annotation'
        data = {'tid': entity['id'],
                'annotation_tid': annotation['id'],
                'value': value,
                'term_version': entity['version'],
                'annotation_term_version': annotation['version']}
        return self.post(url, data)
1172977
public void addAnnotation(final Class<? extends Annotation> clazz, final Annotation ann) {
        foundAnnotations.put(clazz, ann);
        discoverNames();
    }
897725
def set_metadata_for_node(self, node, metadata):
        
        return self.manager.set_metadata(self, metadata, node=node)
124004
private static Set<Annotation> getAnnotations(final Annotation[] annotations, final Class<? extends Annotation> neededAnnotationType) {
        final Set<Annotation> ret = new HashSet<>();

        for (final Annotation annotation : annotations) {
            annotation.annotationType().getAnnotations();
            final Annotation[] metaAnnotations = annotation.annotationType().getAnnotations();
            for (final Annotation metaAnnotation : metaAnnotations) {
                if (metaAnnotation.annotationType().equals(neededAnnotationType)) {
                    ret.add(annotation);
                }
            }
        }

        return ret;
    }
826780
public static void initializeMetadata()
    {
        // TODO: merge inside meta API.
        DbConn cnx = null;
        try
        {
            cnx = Helpers.getNewDbSession();
            Helpers.updateConfiguration(cnx);
            cnx.commit();
        }
        catch (Exception e)
        {
            throw new JqmRuntimeException("Could not set metadata", e);
        }
        finally
        {
            Helpers.closeQuietly(cnx);
        }
    }
579424
def _setDatasets(self, metadata):
        """"""
        # Pull the lot into a list
        cols = list(self.getCSVReader(metadata))

        # sort the cols by view name and ordinal (they come sorted, but lets be sure)
        cols.sort(key=lambda x: [x['viewname'], int(x['ordinal'])])

        # Now group them by their viewname
        for key, grp in groupby(cols, key=lambda x: x["viewname"]):
            self.datasets[key] = list(grp)
1305128
def _set_up_context(cls):
        """"""
        cls.context = AttributeDict()
        cls.context.new_meta = {}
        cls.context.new_transitions = {}
        cls.context.new_methods = {}
742880
private void loadAnnotateParameters() {
    this.annotateParser.addArgument("-m", "--model")
        .required(true)
        .help("It is required to provide a POS tagging model.");
    this.annotateParser.addArgument("-lm", "--lemmatizerModel")
         .required(true)
         .help("It is required to provide a lemmatizer model.");
    this.annotateParser.addArgument("-l", "--language")
        .choices("de", "en", "es", "eu", "fr", "gl", "it", "nl")
        .required(false)
        .help("Choose a language.");

    this.annotateParser.addArgument("--beamSize")
        .required(false)
        .setDefault(DEFAULT_BEAM_SIZE)
        .help("Choose beam size for decoding, it defaults to 3.");
    annotateParser.addArgument("-o", "--outputFormat")
        .required(false)
        .choices("naf", "conll")
        .setDefault(Flags.DEFAULT_OUTPUT_FORMAT)
        .help("Choose output format; it defaults to NAF.\n");
    this.annotateParser.addArgument("-mw", "--multiwords")
        .action(Arguments.storeTrue())
        .help("Use to detect and process multiwords.\n");
    this.annotateParser.addArgument("-d", "--dictag")
        .action(Arguments.storeTrue())
        .help("Post process POS tagger output with a monosemic dictionary.\n");
    this.annotateParser.addArgument("-a","--allMorphology")
        .action(Arguments.storeTrue())
        .help("Print all the POS tags and lemmas before disambiguation.\n");
  }
1055795
function Annotations( parent ) {

	// INSTANCE ATTRIBUTES //

	this._parent = parent;
	this._root = undefined;
	this._children = {};
	this._config = {
		'position': {
			'left': 0,
			'top': 0
		}
	};

	// REGISTER //
	if ( parent._config.hasOwnProperty( 'annotations' )  ) {
		parent._config.annotations.push( this._config );
	} else {
		parent._config.annotations = [ this._config ];
	}
	if ( parent._children.hasOwnProperty( 'annotations' ) ) {
		parent._children.annotations.push( this );
	} else {
		parent._children.annotations = [ this ];
	}

	return this;
}
594088
def set_metadata(self, metadata):
        
        if metadata is not None:
            metadata = np.array(metadata, copy=False).ravel()
        self.metadata = metadata
142083
public void init(Email annotation, PropertyMetadata propertyMetadata)
    {
        m_propertyMetadata = propertyMetadata;
        m_pattern = java.util.regex.Pattern.compile("^" + ATOM + "+(\\." + ATOM + "+)*@"
                + DOMAIN
                + "|"
                + IP_DOMAIN
                + ")$",
        java.util.regex.Pattern.CASE_INSENSITIVE
);
        m_message = annotation.message();
    }
1349016
def update_metadata(source, target) -> None:
    
    target.namespace_url.update(source.namespace_url)
    target.namespace_pattern.update(source.namespace_pattern)

    target.annotation_url.update(source.annotation_url)
    target.annotation_pattern.update(source.annotation_pattern)
    for keyword, values in source.annotation_list.items():
        if keyword not in target.annotation_list:
            target.annotation_list[keyword] = values
        else:
            target.annotation_list[keyword].update(values)