samvera / active_fedora

A Rails interface to the Fedora repository, akin to ActiveModel
Other
54 stars 63 forks source link

Protect server managed triples #764

Open tpendragon opened 9 years ago

tpendragon commented 9 years ago

This is specifically in relation to RDF.type.

class TestClass < ActiveFedora::Base
  property :work_type, :predicate => RDF.type
end

r = TestClass.new
r.save
r.work_type = ["Test"]
r.save
ERROR [line: 1] undefined prefix "java.lang.IllegalArgumentException"
ERROR [line: 1] With input 'Not a valid (absolute) URI: Test
        at org.openrdf.model.impl.URIImpl.setURIString(URIImpl.java:79)
        at': Invalid token "Not" (found "Not"), production = :_triples_1
ERROR [line: 1] Unexpected (found "a"), production = ")"
ERROR [line: 1] undefined prefix "URI"
ERROR [line: 1] With input 'Test
        at org.openrdf.model.impl.URIImpl.setURIString(URIImpl.java:79)
        at org.openrdf.model.impl.URII': Invalid token "Test" (found "Test"), production = :predicateObjectList
Ldp::HttpError: STATUS: 500 java.lang.IllegalArgumentException: Not a valid (absolute) URI: Test
        at org.openrdf.model.impl.URIImpl.setURIString(URIImpl.java:79)
        at org.openrdf.model.impl.URIImpl.<init>(URIImpl.java:68)
        at org.openrdf.model.impl.ValueFactoryImpl.createURI(ValueFactoryImpl.java:50)
        at org.fcrepo.http.commons.responses.RdfStreamStreamingOutput.getValueForObject(RdfStreamStreamingOutput.java:180)
        at org.fcrepo.http.commons.responses.RdfStreamStreamingOutput$3.apply(RdfStreamStreamingOutput.java:159)
        at org.fcrepo.http.commons.responses.RdfStreamStreamingOutput$3.apply(RdfStreamStreamingOutput.java:153)
        at com.google.common.collect.Iterators$8.transform(Iterators.java:799)
        at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
        at org.openrdf.rio.Rio.write(Rio.java:564)
        at org.fcrepo.http.commons.responses.RdfStreamStreamingOutput.write(RdfStreamStreamingOutput.java:123)
        at org.fcrepo.http.commons.responses.RdfStreamStreamingOutput.write(RdfStreamStreamingOutput.j...
tpendragon commented 9 years ago

Should we do anything with this? Is it our responsibility to make sure that the property interface doesn't interfere with LDP's triples?