How to use the extruct.rdflibxml.property.ProcessProperty function in extruct

To help you get started, we’ve selected a few extruct examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scrapinghub / extruct / extruct / rdflibxml / parse.py View on Github external
for prop in state.getURI("rev") :
        if not isinstance(prop,BNode) :
            theTriple = (current_object,prop,current_subject)
            if current_object != None :
                graph.add(theTriple)
            else :
                incomplete_triples.append(theTriple)
        else :
            state.options.add_warning(err_no_blank_node % "rev", warning_type=IncorrectBlankNodeUsage, node=node.nodeName)

    # ----------------------------------------------------------------------
    # Generation of the literal values. The newSubject is the subject
    # A particularity of property is that it stops the parsing down the DOM tree if an XML Literal is generated,
    # because everything down there is part of the generated literal.
    if node.hasAttribute("property") :
        ProcessProperty(node, graph, current_subject, state).generate_1_0()

    # ----------------------------------------------------------------------
    # Setting the current object to a bnode is setting up a possible resource
    # for the incomplete triples downwards
    if current_object == None :
        object_to_children = BNode()
    else :
        object_to_children = current_object

    #-----------------------------------------------------------------------
    # Here is the recursion step for all the children
    for n in node.childNodes :
        if n.nodeType == Node.ELEMENT_NODE :
            _parse_1_0(n, graph, object_to_children, state, incomplete_triples)

    # ---------------------------------------------------------------------
github scrapinghub / extruct / extruct / rdflibxml / parse.py View on Github external
for prop in state.getURI("rev") :
        if not isinstance(prop,BNode) :
            theTriple = (current_object,prop,current_subject)
            if current_object != None :
                graph.add(theTriple)
            else :
                incomplete_triples.append(theTriple)
        else :
            state.options.add_warning(err_no_blank_node % "rev", warning_type=IncorrectBlankNodeUsage, node=node.nodeName)

    # ----------------------------------------------------------------------
    # Generation of the @property values, including literals. The newSubject is the subject
    # A particularity of property is that it stops the parsing down the DOM tree if an XML Literal is generated,
    # because everything down there is part of the generated literal.
    if node.hasAttribute("property") :
        ProcessProperty(node, graph, current_subject, state, typed_resource).generate_1_1()

    # ----------------------------------------------------------------------
    # Setting the current object to a bnode is setting up a possible resource
    # for the incomplete triples downwards
    if current_object == None :
        object_to_children = BNode()
    else :
        object_to_children = current_object

    #-----------------------------------------------------------------------
    # Here is the recursion step for all the children
    for n in node.childNodes :
        if n.nodeType == Node.ELEMENT_NODE :
            _parse_1_1(n, graph, object_to_children, state, incomplete_triples)

    # ---------------------------------------------------------------------