Constraint causing java exception when loading

The following constraint:

@prefix carnot: <http://Carnot.org/> .

carnot:Employee rdfs:subClassOf
	[ a owl:Restriction ;
		owl:onProperty carnot:employeeDepartment;
		owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ;
		owl:onClass carnot:Department
	] .

causes the following exception:

WARN  2018-02-26 09:51:16,393 [RDFStreamProcessor-0] com.complexible.common.rdf.rio.RDFStreamProcessor:setException(584): Error during loading RDF/XMLStream:
Content is not allowed in prolog. [line 1, column 1]
WARN  2018-02-26 09:51:16,396 [RDFStreamProcessor-0] com.complexible.common.rdf.rio.RDFStreamProcessor:setException(591): Parse process creator:
java.lang.Exception: null
        at com.complexible.common.rdf.rio.RDFStreamProcessor.<init>(RDFStreamProcessor.java:129) ~[stardog-utils-rdf-5.0.1.jar:?]
        at com.complexible.common.rdf.rio.RDFStreamProcessor.create(RDFStreamProcessor.java:105) ~[stardog-utils-rdf-5.0.1.jar:?]
        at com.complexible.common.rdf.rio.RDFStreamProcessor.iteration(RDFStreamProcessor.java:110) ~[stardog-utils-rdf-5.0.1.jar:?]
        at com.complexible.common.rdf.impl.StreamStatementIterator.<init>(StreamStatementIterator.java:52) ~[stardog-utils-rdf-5.0.1.jar:?]
        at com.complexible.common.rdf.impl.OneTimeStreamStatementSource.statements(OneTimeStreamStatementSource.java:53) ~[stardog-utils-rdf-5.0.1.jar:?]
        at com.complexible.stardog.protocols.http.icv.client.ICVHttpConnection.handleConstraintChange(ICVHttpConnection.java:110) ~[stardog-icv-protocols-http-client-5.0.1.jar:?]
        at com.complexible.stardog.icv.api.AbstractICVConnection$ValidatorIO.stream(AbstractICVConnection.java:230) ~[stardog-icv-api_snarl-5.0.1.jar:?]
        at com.complexible.stardog.icv.api.AbstractICVConnection$ValidatorIO.file(AbstractICVConnection.java:255) ~[stardog-icv-api_snarl-5.0.1.jar:?]
        at com.complexible.stardog.icv.cli.ICVWithFiles.readConstraints(ICVWithFiles.java:174) ~[stardog-icv-cli-5.0.1.jar:?]
        at com.complexible.stardog.icv.cli.ICVWithFiles.addConstraints(ICVWithFiles.java:96) ~[stardog-icv-cli-5.0.1.jar:?]
        at com.complexible.stardog.icv.cli.ICVAdd.execute(ICVAdd.java:61) ~[stardog-icv-cli-5.0.1.jar:?]
        at com.complexible.stardog.cli.impl.ConnectionCommand.call(ConnectionCommand.java:61) ~[stardog-cli-5.0.1.jar:?]
        at com.complexible.stardog.cli.CLIBase.execute(CLIBase.java:55) ~[stardog-cli-5.0.1.jar:?]
        at com.complexible.stardog.cli.admin.CLI.main(CLI.java:182) ~[stardog-cli-5.0.1.jar:?]
WARN  2018-02-26 09:51:16,403 [RDFStreamProcessor-4] com.complexible.common.rdf.rio.RDFStreamProcessor:setException(587): Error during loading TurtleStream: UT000034: Stream is closed
java.io.IOException: UT000034: Stream is closed 

. . .

It looks like your file is in turtle but it’s trying to read it as rdf/xml. If you don’t tell it what the format is it will try to guess it from the extension and defaults to rdf/xml if it can’t tell. What is the name of your file? Did you name it something like myConstraints.icv?

I named it Constraints.rdf
should it be Constraints.icv

It’s guessing that it’s rdf/xml because of the .rdf extension. You can name it anything you’d like but you’ll need to include the -f flag in “stardog data add” and give it the format. TURTLE, RDF/XML, etc. Or you can rename it to something that Stardog will correctly recognize, .ttl in your case.

That worked.
Thanks soo much.
phil

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.