def _rdf_resource_map_custom_model(e, resource, concept): if concept.Model is Resource: return None kwargs = dict(resource=resource) for p in concept.mandatory_predicates: c = e.find(_JC(p.resource.namespace.uri, p.name)) if c is None: continue match = concept.Model.objects.filter(**kwargs) return None if 0 < match.count() else concept.Model(**kwargs)
from rdf.serializers import _JC, _split_URI, _DXML RDF = get(Namespace, 'rdf') RDFS = get(Namespace, 'rdfs') OWL = get(Namespace, 'owl') DC = get(Namespace, 'dc') DRDFS = get(Namespace, 'drdfs') RESOURCE, CONCEPT, LITERAL, PREDICATE = get( (Concept, RDFS, 'Resource'), (Concept, RDFS, 'Class'), (Concept, RDFS, 'Literal'), (Concept, RDF, 'Property')) RDF_RDF = _JC(RDF.uri, 'RDF') RDF_DESCRIPTION = _JC(RDF.uri, 'Description') RDF_RESOURCE = _JC(RDF.uri, 'resource') RDF_ID = _JC(RDF.uri, 'ID') RDF_ABOUT = _JC(RDF.uri, 'about') RDF_PROPERTY = _JC(RDF.uri, 'Property') RDFS_CLASS = _JC(RDFS.uri, 'Class') RDFS_LITERAL = _JC(RDFS.uri, 'Literal') RDFS_DATATYPE = _JC(RDFS.uri, 'Datatype') RDFS_DOMAIN = _JC(RDFS.uri, 'domain') RDFS_RANGE = _JC(RDFS.uri, 'range') RDFS_LABEL = _JC(RDFS.uri, 'label') RDFS_COMMENT = _JC(RDFS.uri, 'comment') RDFS_ISDEFINEDBY = _JC(RDFS.uri, 'isDefinedBy') RDFS_SUBCLASSOF = _JC(RDFS.uri, 'subClassOf')