Closed MiguelAraCo closed 10 years ago
I don't think that if the resource is not found the method should fail. And because it wasn't doing any checking of some kind, it was failing in a hard to debug way.
To be honest I don't see a reason for this method to exist. It seems its purpose is to return the "primaryTopic" of a resource instead of the actual resource. It appears that this could be useful when working with indirectContainers, but there are a few things that don't quite match:
Sorry if this is confusing, I tried my best in explaining it clear enough.
I've had a chance to review this method in more detail and discuss with some. It would be good for you to post a couple of the RDF that is causing the method to error.
Let me address some of your points:
After evaluating this in more detail, I don't think this whole ldp:insertedContentRelation code is needed. Since there member resource URI and container URI are not both given to the method, these triples should rarely occur in a resource in such a way that it could determine the primary resource. After I see your RDF sample and do a little more evaluation, I would probably just remove that logic altogether.
Now that you closed it, should I open a new one to share the RDF you asked for?
Add it here.
+1 for removing all of this logic. This is the model the method is currently handling when it throws an exception:
@base <http://carbonldp.com/apps/ldp-testsuite/membershipResource/indirectContainer/>.
@prefix ldp: <http://www.w3.org/ns/ldp#>.
@prefix c: <http://carbonldp.com/ns/v1/platform#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
<>
a ldp:IndirectContainer;
c:created "2014-10-29T12:37:58.130-05:00"^^xsd:string;
c:defaultRetrievePreference
ldp:PreferContainment,
ldp:PreferMinimalContainer;
c:modified "2014-11-04T11:40:53.262-06:00"^^xsd:dateTime;
http://example.com/ns#comment "modified";
ldp:contains
<1443994488360126150>,
<2378047310517808607>,
<3045364954094698882>,
<4083305103342022698>,
<4670849290323396662>,
<5721007932776501478>,
<6302739556100581025>,
<7037787392880241375>,
<8632633096817430694>,
<9161483135061249633>;
ldp:hasMemberRelation http://example.org/ns#indirectMember;
ldp:insertedContentRelation foaf:primaryTopic;
ldp:membershipResource http://carbonldp.com/apps/ldp-testsuite/membershipResource.
I must confess to not know what problem this is solving. I see you are ensuring that the values are URIs but just ignoring if there exists a triple with ldp:insertedContentRelation but value is not a URI. Seems like this should be an error, not continue. Can you explain a little more what the problem you are hitting is and how this overcomes it?