Constraint causing java exception when loading

The following constraint:

@prefix carnot: <> .

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] 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] Parse process creator:
java.lang.Exception: null
        at<init>( ~[stardog-utils-rdf-5.0.1.jar:?]
        at ~[stardog-utils-rdf-5.0.1.jar:?]
        at ~[stardog-utils-rdf-5.0.1.jar:?]
        at com.complexible.common.rdf.impl.StreamStatementIterator.<init>( ~[stardog-utils-rdf-5.0.1.jar:?]
        at com.complexible.common.rdf.impl.OneTimeStreamStatementSource.statements( ~[stardog-utils-rdf-5.0.1.jar:?]
        at com.complexible.stardog.protocols.http.icv.client.ICVHttpConnection.handleConstraintChange( ~[stardog-icv-protocols-http-client-5.0.1.jar:?]
        at com.complexible.stardog.icv.api.AbstractICVConnection$ ~[stardog-icv-api_snarl-5.0.1.jar:?]
        at com.complexible.stardog.icv.api.AbstractICVConnection$ValidatorIO.file( ~[stardog-icv-api_snarl-5.0.1.jar:?]
        at com.complexible.stardog.icv.cli.ICVWithFiles.readConstraints( ~[stardog-icv-cli-5.0.1.jar:?]
        at com.complexible.stardog.icv.cli.ICVWithFiles.addConstraints( ~[stardog-icv-cli-5.0.1.jar:?]
        at com.complexible.stardog.icv.cli.ICVAdd.execute( ~[stardog-icv-cli-5.0.1.jar:?]
        at ~[stardog-cli-5.0.1.jar:?]
        at com.complexible.stardog.cli.CLIBase.execute( ~[stardog-cli-5.0.1.jar:?]
        at com.complexible.stardog.cli.admin.CLI.main( ~[stardog-cli-5.0.1.jar:?]
WARN  2018-02-26 09:51:16,403 [RDFStreamProcessor-4] Error during loading TurtleStream: UT000034: Stream is closed 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.

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