Index: src/org/openstreetmap/josm/command/SplitWayCommand.java
===================================================================
--- src/org/openstreetmap/josm/command/SplitWayCommand.java	(revision 16222)
+++ src/org/openstreetmap/josm/command/SplitWayCommand.java	(working copy)
@@ -26,6 +26,7 @@
 
 import javax.swing.JOptionPane;
 
+import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
 import org.openstreetmap.josm.data.osm.Node;
@@ -39,6 +40,7 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
 import org.openstreetmap.josm.gui.widgets.JMultilineLabel;
+import org.openstreetmap.josm.io.BoundingBoxDownloader;
 import org.openstreetmap.josm.io.MultiFetchServerObjectReader;
 import org.openstreetmap.josm.io.OsmTransferException;
 import org.openstreetmap.josm.spi.preferences.Config;
@@ -56,6 +58,7 @@
 
     private static volatile Consumer<String> warningNotifier = Logging::warn;
     private static final String DOWNLOAD_MISSING_PREF_KEY = "split_way_download_missing_members";
+    private static final String DOWNLOAD_MISSING_PARENT_PREF_KEY = "split_way_download_missing_parents";
 
     private static final class RelationInformation {
         boolean warnme;
@@ -349,6 +352,35 @@
         final int indexOfWayToKeep = newWays.indexOf(wayToKeep);
         newWays.remove(wayToKeep);
 
+        if (!way.isNew() && (way.getDataSet().getDataSourceBounds().isEmpty()
+                || way.getNodes().stream().allMatch(Node::isOutsideDownloadArea))) {
+            MissingParentsStrategy missingParentsStrategy;
+            if (ConditionalOptionPaneUtil.getDialogReturnValue(DOWNLOAD_MISSING_PARENT_PREF_KEY) == Integer.MAX_VALUE) {
+                // User has previously told us downloading missing relations is fine.
+                missingParentsStrategy = MissingParentsStrategy.GO_AHEAD_WITH_DOWNLOADS;
+            } else {
+                // Ask the user.
+                missingParentsStrategy = offerToDownloadMissingParentsIfNeeded();
+            }
+            switch (missingParentsStrategy) {
+            case GO_AHEAD_WITH_DOWNLOADS:
+                try {
+                    downloadParents(way);
+                } catch (OsmTransferException e) {
+                    ExceptionDialogUtil.explainException(e);
+                    return Optional.empty();
+                }
+                break;
+            case GO_AHEAD_WITHOUT_DOWNLOADS:
+                // Proceed with the split with the information we have.
+                // This can mean that we break relations.
+                break;
+            case USER_ABORTED:
+            default:
+                return Optional.empty();
+            }
+
+        }
         // Figure out the order of relation members (if any).
         Analysis analysis = analyseSplit(way, wayToKeep, newWays, indexOfWayToKeep);
 
@@ -472,7 +504,7 @@
             int ir = 0;
             List<RelationMember> relationMembers = r.getMembers();
             for (RelationMember rm : relationMembers) {
-                if (rm.isWay() && rm.getMember() == way) {
+                if (rm.getMember() == way) {
                     boolean insert = true;
                     if (relationSpecialTypes.containsKey(type) && "restriction".equals(relationSpecialTypes.get(type))) {
                         RelationInformation rValue = treatAsRestriction(r, rm, c, newWays, way, changedWay);
@@ -541,6 +573,22 @@
                                     // won't help in any case.
                                     direction = Direction.IRRELEVANT;
                                 }
+                                if (direction == Direction.UNKNOWN && (!way.firstNode().isOutsideDownloadArea()
+                                        || way.lastNode().isOutsideDownloadArea())) {
+                                    // check if any other complete way in the relation is connected to the way
+                                    // if so, the order of the relation is broken
+                                    for (int i = 0; i < r.getMembersCount(); i++) {
+                                        if (i >= ir - 1 && i <= ir + 1)
+                                            continue;
+                                        RelationMember rmTest = r.getMember(i);
+                                        if (rmTest.isWay() && !rmTest.getMember().isIncomplete() &&
+                                            (way.isFirstLastNode(rmTest.getWay().firstNode())
+                                                    || way.isFirstLastNode(rm.getWay().lastNode()))) {
+                                                direction = Direction.IRRELEVANT;
+                                                break;
+                                        }
+                                    }
+                                }
                             }
                         } else {
                             int k = 1;
@@ -708,6 +756,63 @@
         MainApplication.getLayerManager().getEditLayer().mergeFrom(ds);
     }
 
+    static MissingParentsStrategy offerToDownloadMissingParentsIfNeeded() {
+        String[] options = {
+                tr("Yes, download areas"),
+                tr("No, abort the split operation"),
+                tr("No, perform the split without downloading")
+        };
+
+        JMultilineLabel msg = new JMultilineLabel(tr("This way may be part of a relation. <br>"
+                + "None of the nodes of this way is in a download area. If the way is member of one or more relations "
+                + "those relations might need to be updated.<br> Download area around end nodes to get needed information?"));
+        msg.setMaxWidth(600);
+
+        int ret = JOptionPane.showOptionDialog(
+                MainApplication.getMainFrame(),
+                msg,
+                tr("Download missing information about parent relations?"),
+                JOptionPane.OK_CANCEL_OPTION,
+                JOptionPane.QUESTION_MESSAGE,
+                null,
+                options,
+                options[0]
+                );
+
+        switch (ret) {
+        case JOptionPane.OK_OPTION:
+            // Ask the user if they want to do this automatically from now on. We only ask this for the download
+            // action, because automatically cancelling is confusing (the user can't tell why this happened), and
+            // automatically performing the split without downloading missing parent relations is
+            // likely to break relations.
+            ConditionalOptionPaneUtil.showMessageDialog(
+                    DOWNLOAD_MISSING_PARENT_PREF_KEY,
+                    MainApplication.getMainFrame(),
+                    tr("Missing parent relations will be downloaded. Should this be done automatically from now on?"),
+                    tr("Downloading missing parent relation"),
+                    JOptionPane.INFORMATION_MESSAGE
+                    );
+            return MissingParentsStrategy.GO_AHEAD_WITH_DOWNLOADS;
+        case JOptionPane.CANCEL_OPTION:
+            return MissingParentsStrategy.GO_AHEAD_WITHOUT_DOWNLOADS;
+        default:
+            return MissingParentsStrategy.USER_ABORTED;
+        }
+    }
+
+
+    private static void downloadParents(Way way) throws OsmTransferException {
+        // Download possible parent relations
+        Set<Node> endNodes = new HashSet<>(Arrays.asList(way.firstNode(), way.lastNode()));
+        for (Node n : endNodes) {
+            if (n.isOutsideDownloadArea() || n.getDataSet().getDataSourceBounds().isEmpty()) {
+                BoundingBoxDownloader reader = new BoundingBoxDownloader(new Bounds(n.getCoor(), true));
+                DataSet ds = reader.parseOsm(NullProgressMonitor.INSTANCE);
+                MainApplication.getLayerManager().getEditLayer().mergeFrom(ds);
+            }
+        }
+    }
+
     static SplitWayCommand splitBasedOnAnalyses(Way way,
                                                 List<Way> newWays,
                                                 List<OsmPrimitive> newSelection,
@@ -964,4 +1069,10 @@
         GO_AHEAD_WITHOUT_DOWNLOADS,
         USER_ABORTED
     }
+
+    enum MissingParentsStrategy {
+        GO_AHEAD_WITH_DOWNLOADS,
+        GO_AHEAD_WITHOUT_DOWNLOADS,
+        USER_ABORTED
+    }
 }
