Package org.apache.any23.extractor.yaml
Class ElementsProcessor
- java.lang.Object
-
- org.apache.any23.extractor.yaml.ElementsProcessor
-
public class ElementsProcessor extends Object
Converts Object into RDF graph encoded toElementsProcessor.ModelHolder
. Where key is a graph root node and value is a graph itself inside aModel
. This parser performs conversion for three main types:- List - Creates RDF:List with bnode as root
- Map - Creates simple graph where {key: value} is converted to predicate:object pair
- Simple type - Crates RDF Literal
- Author:
- Jacek Grzebyta (grzebyta.dev [at] gmail.com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ElementsProcessor.ModelHolder
A model holder describes the two required parameters which makes a model useful in further processing: a root node and model itself.
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.rdf4j.model.ValueFactory
vf
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ElementsProcessor.ModelHolder
asModel(org.eclipse.rdf4j.model.IRI namespace, Object t, org.eclipse.rdf4j.model.Value rootNode)
Converts a data structure toElementsProcessor.ModelHolder
.static ElementsProcessor
getInstance()
protected ElementsProcessor.ModelHolder
processList(org.eclipse.rdf4j.model.IRI ns, List<Object> object)
protected ElementsProcessor.ModelHolder
processMap(org.eclipse.rdf4j.model.IRI ns, Map<String,Object> object, org.eclipse.rdf4j.model.Value parentNode)
This method processes a map with non bnode root.
-
-
-
Method Detail
-
asModel
public ElementsProcessor.ModelHolder asModel(org.eclipse.rdf4j.model.IRI namespace, Object t, org.eclipse.rdf4j.model.Value rootNode)
Converts a data structure toElementsProcessor.ModelHolder
. where value is a root node of the data structure and model is a content of the RDF graph. If requested object is simple object (i.e. is neither List or Map) than method returns map entry of relevant instance ofLiteral
as key and empty model as value.- Parameters:
namespace
- Namespace for predicatest
- Object (or data structure) converting to RDF graphrootNode
- root node of the graph. If not given then blank node is created.- Returns:
- instance of
ElementsProcessor.ModelHolder
,
-
processMap
protected ElementsProcessor.ModelHolder processMap(org.eclipse.rdf4j.model.IRI ns, Map<String,Object> object, org.eclipse.rdf4j.model.Value parentNode)
This method processes a map with non bnode root. If a map has instantiated root (not a blank node) it is simpler to create SPARQL query.- Parameters:
ns
- the namespace to associated with statementsobject
- a populatedMap
parentNode
- aValue
subject node to use in the new statement- Returns:
- instance of
ElementsProcessor.ModelHolder
.
-
processList
protected ElementsProcessor.ModelHolder processList(org.eclipse.rdf4j.model.IRI ns, List<Object> object)
-
getInstance
public static final ElementsProcessor getInstance()
-
-