This branch should fix the problem
https://github.com/fcrepo/fcrepo/tree/fcrepo-1041

Steve, can you test it easily? Otherwise, I will do it.

Regards

On 12/13/2011 04:11 PM, Stephen Bayliss wrote:
Message https://jira.duraspace.org/browse/FCREPO-1041 raised for this.
 
-----Original Message-----
From: Stephen Bayliss [mailto:stephen.bayliss@acuityunlimited.net]
Sent: 13 December 2011 14:58
To: 'Support and info exchange list for Fedora users.'
Subject: Re: [fcrepo-user] Enhanced content models - validating typeof relationship target gives 404 if target does not exist

Thanks Asger - it returns plain text of the missing object (but this was from a browser, haven't tried requesting content type of text/xml).  I'll raise a JIRA for this.
 
Cheers
Steve
-----Original Message-----
From: Asger Askov Blekinge [mailto:abr@statsbiblioteket.dk]
Sent: 13 December 2011 14:25
To: fedora-commons-users@lists.sourceforge.net
Subject: Re: [fcrepo-user] Enhanced content models - validating type of relationship target gives 404 if target does not exist

That sounds like a bug.

Remember, the 404 message can still contain an xml error. So, does it return an empty page, or the xml? Using the http return codes might not be in error.

Should validate returon 2xx when the validation fails?

Regards


On 12/13/2011 01:51 PM, Stephen Bayliss wrote:
In the ONTOLOGY datastream of a content model object, one can specify
- the cardinality of a relationship
- the type (ie type from hasModel relationship) of the target
 
I am finding that if the target object does not exist, then the validate method is reporting a 404 error.  That's the same error as one would get if one tried to validate an object that didn't exist; so it would instead be useful to give the XML error to distinguish between these two cases.
 
So, if I have the relationship in test:1's RELS-EXT as follows:
<info:fedora/test:1> <fedora-model:hasModel> <info:fedora/test:CModel-1>
<info:fedora/test:1> <rel:isMemberOf> <info:fedora/test:collection>
 
And then in the CModel CModel-1 I define
 
 
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty rdf:resource="info:fedora/fedora-system:def/relations-external#isMemberOf"/>
        <owl:minCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1</owl:minCardinality>
      </owl:Restriction>
    </rdfs:subClassOf>
 
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty rdf:resource="info:fedora/fedora-system:def/relations-external#isMemberOf"/>
        <owl:allValuesFrom rdf:resource="info:fedora/test:CModel-collection#class"/>
      </owl:Restriction>
    </rdfs:subClassOf>
 
Then if the object test:collection does not exist, on validating test:1 I get a 404 error because it does not exist.
 
Does this sound like a bug?
 
Steve