Package org.jrdf.graph

Examples of org.jrdf.graph.SubjectNode


    }

    public void writeNestedStatements(final IteratorStack<Triple> stack) throws WriteException, XMLStreamException {
        statement.writePredicateObject(currentTriple.getPredicate(), currentTriple.getObject());
        while (stack.hasNext()) {
            SubjectNode currentSubject = currentTriple.getSubject();
            currentTriple = stack.pop();
            // Have we run out of the same subject - if so push it back on an stop iterating.
            if (!currentSubject.equals(currentTriple.getSubject())) {
                stack.push(currentTriple);
                break;
            }
            xmlStreamWriter.writeCharacters("    ");
            statement.writePredicateObject(currentTriple.getPredicate(), currentTriple.getObject());
View Full Code Here


        }
        return moleculeFactory.createMolecule(triples);
    }

    private Triple convertTriple(Triple triple) {
        SubjectNode subject = triple.getSubject();
        PredicateNode predicate = triple.getPredicate();
        ObjectNode object = triple.getObject();
        if (map.containsKey(subject)) {
            subject = map.get(subject);
        }
View Full Code Here

        }
    }

    private void getNewBlankNodes(Set<BlankNode> newNodes, ClosableIterable<Triple> triples) {
        for (Triple triple : triples) {
            SubjectNode newNode = triple.getSubject();
            if (isBlankNode(newNode) && (!visitedNodes.contains((BlankNode) newNode))) {
                currentTriple = triple;
                newNodes.add((BlankNode) newNode);
            }
        }
View Full Code Here

    // TODO YF a more robust version of findLinkingTriple is needed.
    private Triple findLinkingTriple(Molecule parentMolecule, Triple[] roots, Map<BlankNode, Triple> rootTripleMap,
                                     Molecule molecule) throws GraphException {
        for (Triple triple : roots) {
            SubjectNode sub = triple.getSubject();
            if (AbstractBlankNode.isBlankNode(sub) && mapContainsBNode(rootTripleMap, sub)) {
                return rootTripleMap.get(sub);
            }

        }
View Full Code Here

        nodeParser = new NodeParserImpl();
    }

    public Triple parseTripleLine(final RegexMatcher subjectMatcher, final RegexMatcher predicateMatcher,
        final RegexMatcher objectMatcher) throws ParseException {
        final SubjectNode subject = (SubjectNode) nodeParser.parseNode(nodeMaps.getSubjectMap(), subjectMatcher);
        final PredicateNode predicate = (PredicateNode) nodeParser.parseNode(nodeMaps.getPredicateMap(),
            predicateMatcher);
        final ObjectNode object = (ObjectNode) nodeParser.parseNode(nodeMaps.getObjectMap(), objectMatcher);
        if (subject != null && predicate != null && object != null) {
            return tripleFactory.createTriple(subject, predicate, object);
View Full Code Here

        } else {
            // topElement instanceof PropertyElement
            PropertyElement predicate = (PropertyElement) topElement;

            if (predicate.parseCollection()) {
                SubjectNode lastListResource = predicate.getLastListResource();

                if (null == lastListResource) {
                    // no last list resource, list must have been empty.
                    NodeElement subject = (NodeElement) peekStack(1);
View Full Code Here

        if (verifyData) {
            // Check the element name
            checkNodeEltName(namespaceURI, localName, qName);
        }

        SubjectNode nodeResource = getNodeResource(atts);
        NodeElement nodeElement = new NodeElement(nodeResource);

        if (!elementStack.isEmpty()) {
            // node can be object of a statement, or part of an rdf:List
            NodeElement subject = (NodeElement) peekStack(1);
            PropertyElement predicate = (PropertyElement) peekStack(0);

            if (predicate.parseCollection()) {
                SubjectNode lastListRes = predicate.getLastListResource();
                BlankNode newListRes = createBNode();

                if (null == lastListRes) {
                    // first element in the list
                    reportStatement(subject.getResource(), predicate.getURI(), newListRes);
View Full Code Here

            if (1 < definedAttsCount) {
                sendError("Only one of the attributes rdf:ID, rdf:about or rdf:nodeID can be used here");
            }
        }

        SubjectNode result;
        if (null != id) {
            result = buildURIFromID(id.getValue());
        } else if (null != about) {
            result = buildURIFromReference(about.getValue());
        } else if (null != nodeID) {
View Full Code Here

    /**
     * processes subject attributes. *
     */
    private void processSubjectAtts(NodeElement nodeElt, Atts atts) throws SAXException {

        SubjectNode subject = nodeElt.getResource();

        Iterator iter = atts.iterator();

        while (iter.hasNext()) {
            Att att = (Att) iter.next();
View Full Code Here

                Literal lit = createLiteral("", xmlLang, null);
                reportStatement(subject.getResource(), propURI, lit);
                handleReification(lit);
            } else {
                // Create resource for the statement's object.
                SubjectNode resourceRes = getPropertyResource(atts);

                // All special rdf attributes have been checked/removed.
                if (verifyData) {
                    checkRdfAtts(atts);
                }
View Full Code Here

TOP

Related Classes of org.jrdf.graph.SubjectNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.