In Desktop, we have created to layers from the same source feature class that are differentiated by definition queries. We then create a relationship class (in the map document) for both layers to a single table. This works great in desktop, but when we publish the map service to ArcGIS Server, one layer is assigned both relationships and the other has none. From what I can see, when the data is published to ArcGIS Server, the relationships are established on layer source name and ignore layer IDs or layer names.
In desktop:
Published to AGS:
Screenshot from AGS rest endpoint:
10.4.1 environment
Do the feature classes and tables that participate in the relationship reside in the same geodatabase?
I know back at 10.3.1 relates between feature classes and tables in separate geodatabases were not recongized by ArcGIS Server. From testing I have done on 10.5.1, this issue appears to have been resolved.
You might also try breaking out the filtered data into 2 separate feature classes and then create the relationship on the individual feature classes instead of using the same datasource with 2 definition queries applied (This would just be a workaround as your setup in theory should work).