Return true if there is already an owl:Class with the old id
11364
def alreadyHasEntry(oldClassString, og):
    
    namespace = oldClassString.split(':')[0]
    if namespace == 'http':
        target = rdflib.URIRef(oldClassString)
        print('OLD CLASS ID IS A URL', oldClassString)
    else:
        try:
            og.add_known_namespaces(namespace)
            target = og.expand(oldClassString)
        except KeyError:
            print('MISSING NAMESPACE', namespace, oldClassString)
            return True  # we only want known namespaces
    return (target, rdf.type, owl.Class) in og.g
82476
def update_with_diff(self, identifier, new_instance):
        
        with self.flushing():
            instance = self.retrieve(identifier)
            before = Version(instance)
            self.merge(instance, new_instance)
            instance.updated_at = instance.new_timestamp()
            after = Version(instance)
        return instance, before - after
122302
def duplicate(self):
        '''
        
        '''
        return self.__class__(self.method, self.status, self.date, self.ref)
75677
function isLoadNeeded(newProps, oldProps) {
        return newProps.entityType !== oldProps.entityType || newProps.entityId !== oldProps.entityId || newProps.entityCode !== oldProps.entityCode;
      }
663519
function(newchild, oldchild, lastnode, id, ids) {
		var result = true;
		while (newchild && oldchild && !this._updates.hardupdates(id)) {
			switch (newchild.nodeType) {
				case Node.TEXT_NODE:
					result = this._check(newchild, oldchild, lastnode, id, ids);
					break;
				case Node.ELEMENT_NODE:
					result = this._scan(newchild, oldchild, lastnode, id, ids);
					break;
			}
			newchild = newchild.nextSibling;
			oldchild = oldchild.nextSibling;
		}
		return result;
	}
128587
def tree_is_in_collection(collection, study_id=None, tree_id=None):
    
    included = collection_to_included_trees(collection)
    study_id = study_id.strip()
    tree_id = tree_id.strip()
    for decision in included:
        if decision['studyID'] == study_id and decision['treeID'] == tree_id:
            return True
    return False
1281512
def filtered_search(
            self,
            id_list: List,
            negated_classes: List,
            limit: Optional[int] = 100,
            taxon_filter: Optional[int] = None,
            category_filter: Optional[str] = None,
            method: Optional[SimAlgorithm] = SimAlgorithm.PHENODIGM) -> SimResult:
        
        if len(negated_classes) > 0:
            logging.warning("Owlsim2 does not support negation, ignoring neg classes")

        namespace_filter = self._get_namespace_filter(taxon_filter, category_filter)
        owlsim_results = search_by_attribute_set(self.url, tuple(id_list), limit, namespace_filter)
        return self._simsearch_to_simresult(owlsim_results, method)
739141
def class_exists?(name)
      rslt = true
      begin
        get_class name
      rescue OrientdbError => e
        raise e if e.is_a? ConnectionError and e.message == 'not connected' # workaround for AOP2 (unable to decorate already existing methods)
        rslt = false
      end
      rslt
    end
498742
function hasClass(elm, name) {
        var re = classRE(name);
        return elm.className && elm.className.match(re);
    }
574937
def on_add(self, widget, new_dict=False):
        "
        self.semantic_data_counter += 1
        treeiter, path = self.get_selected_object()

        value = dict() if new_dict else "New Value"

        # get target dict path
        if treeiter:
            target_dict_path_as_list = self.tree_store[path][self.ID_STORAGE_ID]
            if not self.tree_store[path][self.IS_DICT_STORAGE_ID]:
                target_dict_path_as_list.pop()
        else:
            target_dict_path_as_list = []

        # generate key
        target_dict = self.model.state.get_semantic_data(target_dict_path_as_list)
        new_key_string = generate_semantic_data_key(list(target_dict.keys()))
        self.model.state.add_semantic_data(target_dict_path_as_list, value, new_key_string)

        self.reload_tree_store_data()

        # jump to new element
        self.select_entry(target_dict_path_as_list + [new_key_string])
        logger.debug("Added new semantic data entry!")
        return True
692647
def is_changed(obj):
    
    revision_field = get_version_fieldname(obj)
    version = get_revision_of_object(obj)
    return not obj.__class__.objects.filter(**{obj._meta.pk.name: obj.pk,
                                               revision_field: version}).exists()
5727
def _has_changed(instance):
    
    for field, value in instance._original_fields.items():
        if field != 'pk' and \
           not isinstance(instance._meta.get_field(field), ManyToManyField):
            try:
                if field in getattr(instance, '_tracked_fields', []):
                    if isinstance(instance._meta.get_field(field), ForeignKey):
                        if getattr(instance, '{0}_id'.format(field)) != value:
                            return True
                    else:
                        if getattr(instance, field) != value:
                            return True
            except TypeError:
                # Can't compare old and new value, should be different.
                return True
    return False
938929
def exists(self, model_class, ID):
        ''''''

        assert hasattr(model_class, '_fields'), 'Not a valid model class'
        res = self.get(model_class, id=ID, fetchOne=True)
        if res:
            return True
        return False
947221
def already_resolved(self, pattern: QueryTriple) -> bool:
        
        if self.sparql_locked or pattern == (None, None, None):
            return True
        for resolved_node in self.resolved_nodes:
            if resolved_node != (None, None, None) and \
                    (pattern[0] == resolved_node[0] or resolved_node[0] is None) and \
                    (pattern[1] == resolved_node[1] or resolved_node[1] is None) and\
                    (pattern[2] == resolved_node[2] or resolved_node[2] is None):
                return True
        return False
1277148
private boolean willObjectBeDeletedLocked(String id) {
    if (!this.items.containsKey(id)) {
      return false;
    }
    Deque<MutablePair<DeltaType, Object>> deltas = this.items.get(id);
    return !(Collections.isEmptyCollection(deltas))
        && deltas.peekLast().getLeft().equals(DeltaType.Deleted);
  }
726395
def has_new_revision(self):
        
        if self.history.current_revision is None:
            return self.state.revision_id is not None

        current_revision_id = self.history.current_revision.revision_id
        return self.state.revision_id != current_revision_id
950108
function(newnode, oldnode, lastnode, id, ids) {
		var result = true;
		var isSoftUpdate = false;
		var isPluginUpdate = false; // TODO: plugins...
		if ((newnode && !oldnode) || (!newnode && oldnode)) {
			result = false;
		} else if ((result = newnode.nodeType === oldnode.nodeType)) {
			switch (oldnode.nodeType) {
				case Node.TEXT_NODE:
					if (newnode.data !== oldnode.data) {
						result = false;
					}
					break;
				case Node.ELEMENT_NODE:
					if ((result = this._familiar(newnode, oldnode))) {
						if ((result = this._checkatts(newnode, oldnode, ids))) {
							if (this._maybesoft(newnode, oldnode)) {
								if (this._confirmsoft(newnode, oldnode)) {
									this._updatesoft(newnode, oldnode, ids);
									isSoftUpdate = true; // prevents the replace update
								}
								result = false; // crawling continued in _updatesoft
							} else {
								if (oldnode.localName !== "textarea") { // TODO: better forms support!
									result = newnode.childNodes.length === oldnode.childNodes.length;
									if (!result && oldnode.id) {
										lastnode = newnode;
										id = oldnode.id;
									}
								}
							}
						}
					}
					break;
			}
		}
		if (!result && !isSoftUpdate && !isPluginUpdate) {
			this._updates.collect(new edbml.FunctionUpdate(this._doc).setup(id));
			this._updates.collect(new edbml.HardUpdate(this._doc).setup(id, lastnode));
		}
		return result;
	}