def METHOD_NAME(apps):
    nodes = apps.get_model("models", "Node")
    tiles = apps.get_model("models", "Tile")
    relations = apps.get_model("models", "ResourceXResource")
    resource = apps.get_model("models", "Resource")
    resource_instance_nodes = {
        str(node["nodeid"]): node["datatype"]
        for node in nodes.objects.filter(Q(datatype="resource-instance") | Q(datatype="resource-instance-list")).values(
            "nodeid", "datatype"
        )
    }
    resource_instance_tiles = tiles.objects.filter(
        Q(nodegroup_id__node__datatype="resource-instance") | Q(nodegroup_id__node__datatype="resource-instance-list")
    ).distinct()
    root_ontology_classes = {
        str(node["graph_id"]): node["ontologyclass"] for node in nodes.objects.filter(istopnode=True).values("graph_id", "ontologyclass")
    }
    return resource, relations, resource_instance_nodes, resource_instance_tiles, root_ontology_classes