Java Code Examples for org.eclipse.rdf4j.rio.RDFHandlerException#toString()

The following examples show how to use org.eclipse.rdf4j.rio.RDFHandlerException#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SnakRdfConverter.java    From Wikidata-Toolkit with Apache License 2.0 6 votes vote down vote up
@Override
public Void visit(ValueSnak snak) {
	String propertyUri = Vocabulary.getPropertyUri(snak.getPropertyId(),
			this.currentPropertyContext);
	IRI property = this.rdfWriter.getUri(propertyUri);
	Value value = valueRdfConverter.getRdfValue(snak.getValue(),
			snak.getPropertyId(), this.simple);
	if (value == null) {
		// if there is no complex representation and simple = false
		return null;
	}

	try {
		this.rdfWriter.writeTripleValueObject(this.currentSubject,
				property, value);
	} catch (RDFHandlerException e) {
		throw new RuntimeException(e.toString(), e);
	}

	return null;
}
 
Example 2
Source File: SnakRdfConverter.java    From Wikidata-Toolkit with Apache License 2.0 6 votes vote down vote up
@Override
public Void visit(SomeValueSnak snak) {
	String rangeUri = getRangeUri(snak.getPropertyId());
	if (rangeUri == null) {
		logger.error("Count not export SomeValueSnak for property "
				+ snak.getPropertyId().getId() + ": OWL range not known.");
		return null;
	}

	// SomeValueSnaks only have simple values not full values
	if (this.currentPropertyContext == PropertyContext.VALUE || this.currentPropertyContext == PropertyContext.QUALIFIER || this.currentPropertyContext == PropertyContext.REFERENCE) {
		return null;
	}

	String propertyUri = Vocabulary.getPropertyUri(snak.getPropertyId(),
			this.currentPropertyContext);
	Resource bnode = this.rdfWriter.getFreshBNode();
	try {
		this.rdfWriter.writeTripleValueObject(this.currentSubject,
				this.rdfWriter.getUri(propertyUri), bnode);
	} catch (RDFHandlerException e) {
		throw new RuntimeException(e.toString(), e);
	}

	return null;
}
 
Example 3
Source File: RdfSerializer.java    From Wikidata-Toolkit with Apache License 2.0 5 votes vote down vote up
@Override
public void open() {
	try {
		this.rdfWriter.start();
		this.rdfConverter.writeNamespaceDeclarations();
		this.rdfConverter.writeBasicDeclarations();
	} catch (RDFHandlerException e) { // we cannot recover here
		throw new RuntimeException(e.toString(), e);
	}
}
 
Example 4
Source File: RdfSerializer.java    From Wikidata-Toolkit with Apache License 2.0 5 votes vote down vote up
@Override
public void processItemDocument(ItemDocument itemDocument) {
	try {
		this.rdfConverter.writeItemDocument(itemDocument);
	} catch (RDFHandlerException e) { // we cannot recover here
		throw new RuntimeException(e.toString(), e);
	}
}
 
Example 5
Source File: RdfSerializer.java    From Wikidata-Toolkit with Apache License 2.0 5 votes vote down vote up
@Override
public void processPropertyDocument(PropertyDocument propertyDocument) {
	try {
		this.rdfConverter.writePropertyDocument(propertyDocument);
	} catch (RDFHandlerException e) { // we cannot recover here
		throw new RuntimeException(e.toString(), e);
	}
}
 
Example 6
Source File: SnakRdfConverter.java    From Wikidata-Toolkit with Apache License 2.0 5 votes vote down vote up
@Override
public Void visit(NoValueSnak snak) {
	if (simple) {
		if (getRangeUri(snak.getPropertyId()) == null) {
			logger.error("Count not export NoValueSnak for property "
					+ snak.getPropertyId().getId()
					+ ": OWL range not known.");
			return null;
		}

		String noValueClass;
		if ((this.currentPropertyContext == PropertyContext.QUALIFIER)
				|| (this.currentPropertyContext == PropertyContext.QUALIFIER_SIMPLE)) {
			noValueClass = Vocabulary.getPropertyUri(snak.getPropertyId(),
					PropertyContext.NO_QUALIFIER_VALUE);
		} else {
			noValueClass = Vocabulary.getPropertyUri(snak.getPropertyId(),
					PropertyContext.NO_VALUE);
		}
		// TODO add restrictions
		try {
			this.rdfWriter.writeTripleUriObject(this.currentSubject,
					RdfWriter.RDF_TYPE, noValueClass);
		} catch (RDFHandlerException e) {
			throw new RuntimeException(e.toString(), e);
		}
	}
	return null;
}