Class ElementsProcessor


  • public class ElementsProcessor
    extends Object
    Converts Object into RDF graph encoded to ElementsProcessor.ModelHolder. Where key is a graph root node and value is a graph itself inside a Model. 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)
    • Field Detail

      • vf

        protected org.eclipse.rdf4j.model.ValueFactory vf
    • 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 to ElementsProcessor.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 of Literal as key and empty model as value.
        Parameters:
        namespace - Namespace for predicates
        t - Object (or data structure) converting to RDF graph
        rootNode - 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 statements
        object - a populated Map
        parentNode - a Value subject node to use in the new statement
        Returns:
        instance of ElementsProcessor.ModelHolder.