All Implemented Interfaces:
RdfType

public class RdfClass extends RdfTypeComplexBase
An RdfClass is one type of implementation that can map Java objects to and from RDF graphs.
  • Field Details

    • entityOps

      protected org.aksw.commons.beans.model.EntityOps entityOps
      The affected class (maybe we should use the fully qualified class name instead?)
    • concept

      protected org.aksw.jenax.sparql.fragment.impl.Concept concept
      The concept that captures rdf terms that are instances of this class. In the simplest case this is { ?s | ?s a <http://example.org/ontology/SomeType> }
    • defaultIriFn

      protected Function<Object,String> defaultIriFn
      A function for obtaining a default IRI from an object
    • populators

      protected List<RdfMapper> populators
      Populators are used to map between property values and RDF data A single populator may thereby set multiple properties at once. However, the value and the RdfType of the property determine whether additional population is needed. A persistenceContext is used to keep track of beans that were not populated yet. Each property has a corresponding RdfType
    • propertyDescriptors

      protected Map<String,RdfPropertyDescriptor> propertyDescriptors
      PropertyDescriptors map the Java property types to RdfType instances. The population status of a property value depends on the RdfType and value in regard to a persistenceContext.
    • isPopulated

      protected boolean isPopulated
  • Constructor Details

    • RdfClass

      public RdfClass(org.aksw.commons.beans.model.EntityOps targetClass, Function<Object,String> defaultIriFn)
  • Method Details

    • getPropertyMappers

      public Collection<RdfMapper> getPropertyMappers()
    • getPropertyDescriptors

      public Collection<RdfPropertyDescriptor> getPropertyDescriptors()
    • getPropertyDescriptors

      public RdfPropertyDescriptor getPropertyDescriptors(String propertyName)
    • getEntityOps

      public org.aksw.commons.beans.model.EntityOps getEntityOps()
    • getConcept

      public org.aksw.jenax.sparql.fragment.impl.Concept getConcept()
    • setPopulated

      public void setPopulated(boolean isPopulated)
    • checkPopulated

      public void checkPopulated()
    • addPropertyDescriptor

      public void addPropertyDescriptor(RdfPropertyDescriptor propertyDescriptor)
    • addPropertyMapper

      public void addPropertyMapper(RdfMapper populator)
    • isPopulated

      public boolean isPopulated()
      Whether this RdfClass instance is fully initialized.
      Returns:
    • getEntityClass

      public Class<?> getEntityClass()
      Description copied from interface: RdfType
      Return the Java class corresponding to this type (maybe it should be Type instead of Class)
      Returns:
    • exposeShape

      public void exposeShape(org.aksw.jena_sparql_api.shape.ResourceShapeBuilder builder)
    • getMethodInterceptor

      public static MethodInterceptorRdf getMethodInterceptor(Object o)
    • getRootNode

      public org.apache.jena.graph.Node getRootNode(Object o)
      Returns the subject of a given object or null if not present. First the object is checked for whether it is a proxy referring to a prior subject, which is returned if present. Otherwise, a default iri will be generated.
      Parameters:
      o -
      Returns:
    • toJava

      public Object toJava(org.apache.jena.graph.Node node)
    • populate

      public EntityFragment populate(org.apache.jena.rdf.model.Resource shape, Object entity)
      Set property values of the given target object based a DatasetGraph.
      Parameters:
      entity -
      datasetGraph -
    • createProxy

      @Deprecated public Object createProxy(org.apache.jena.sparql.core.DatasetGraph datasetGraph, org.apache.jena.graph.Node subject)
      Deprecated.
      Use createJavaObject first, and initialize values from a datasetGraph using a separate call to one of the methods of this class TODO which method?
      Create a proxied instance of the class based on the given graph
      Parameters:
      datasetGraph -
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createJavaObject

      public Object createJavaObject(org.apache.jena.rdf.model.RDFNode r)
      Description copied from interface: RdfType
      Extract a Java (literal) object from a given node. Note: Creating a *non-primitive* java object is not a concern of RdfType which only *MAPS* between a java object and its corresponding triples. The reason is, that via the RdfType's entity class the association to a newInstance method can be indirectly made on the outside, without RdfType having to be aware of it. Also, an RdfType reading a collection may be capable of reading and writing to any collection type, regardless of the concrete sub-type (list, set, etc). Create an empty java object (i.e. no properties set) based on the given node. In the case of primitive types (e.g. String, Long, etc), the object will already carry the correct value. In the case of classes, the result may either be a Java object regardless of the node argument, or a proxy to such java object that holds the node
      Returns:
    • hasIdentity

      public boolean hasIdentity()
      Description copied from interface: RdfType
      Flag to indicate whether entities created from this mapping have their own identity. If not, ids are usually derived from the parent object
      Returns:
    • exposeFragment

      public void exposeFragment(ResourceFragment out, org.apache.jena.rdf.model.Resource priorState, Object entity)
      Return an RDF graph from the entity, where nodes may be placeholders
      Parameters:
      entity -
    • resolve

      public PathFragment resolve(String propertyName)
      Specified by:
      resolve in interface RdfType
      Overrides:
      resolve in class RdfTypeBase