Examples of URIReference


Examples of org.jrdf.graph.URIReference

        }
        performance.outputResult(graph, startTime, "Testing Find Performance: " + noFinds);
    }

    private void find1(Graph graph, URI subjectURI) throws GraphException {
        URIReference predicate = graph.getElementFactory().createURIReference(subjectURI);
        ClosableIterable<Triple> triples = findAllPredicates(graph, predicate);
        try {
            for (Triple triple : triples) {
                ObjectNode object = triple.getObject();
                find2(graph, object);
View Full Code Here

Examples of org.jrdf.graph.URIReference

        //get the Factories
        GraphElementFactory elementFactory = graph.getElementFactory();
        TripleFactory tripleFactory = graph.getTripleFactory();

        //create a resource to identify the statement
        URIReference statement = elementFactory.createURIReference(new URI("http://example.org/statement#address"));

        //reify the address statement (person, hasAddress, address)
        tripleFactory.reifyTriple(addressStatement, statement);

        //insert a statement about the original statement
        URIReference manager = elementFactory.createURIReference(new URI("http://example.org/managerid#65"));
        URIReference hasConfirmed = elementFactory.createURIReference(new URI("http://example.org/terms#hasConfirmed"));
        Triple confirmationStatement = tripleFactory.createTriple(manager, hasConfirmed, statement);
        graph.add(confirmationStatement);

        //print the contents
        print("Graph contains (after reification): ", graph);
View Full Code Here

Examples of org.jrdf.graph.URIReference

        for (int index = 0; index < nodesToUpdate; index++) {
            URI subjectURI = URI.create(subjectPrefix + index);
            List<Triple> triplesToChange = addTriplesToArray(graph, subjectURI);
            for (Triple triple : triplesToChange) {
                URI subject = ((URIReference) triple.getSubject()).getURI();
                URIReference newSubject = graph.getElementFactory().createURIReference(
                    URI.create(subject.toString() + "hello"));
                graph.add(newSubject, triple.getPredicate(), triple.getObject());
                graph.remove(triple);
                noUpdates++;
            }
View Full Code Here

Examples of org.jrdf.graph.URIReference

        }
        performance.outputResult(graph, startTime, "Testing Update Performance: " + noUpdates);
    }

    private List<Triple> addTriplesToArray(Graph graph, URI subjectURI) throws Exception {
        URIReference newSubject = graph.getElementFactory().createURIReference(subjectURI);
        ClosableIterable<Triple> triples = findAllPredicates(graph, newSubject);
        List<Triple> triplesToChange = new ArrayList<Triple>();
        try {
            for (Triple triple : triples) {
                triplesToChange.add(triple);
View Full Code Here

Examples of org.jrdf.graph.URIReference

            }
        }

        if (!"Description".equals(localName) || !namespaceURI.equals(BASE_URI_STR)) {
            // element name is uri's type
            URIReference className;
            if ("".equals(namespaceURI)) {
                // No namespace, use base URI
                className = buildResourceFromLocalName(localName);
            } else {
                className = createURIReference(namespaceURI + localName);
            }
            reportStatement(nodeResource, RDF_TYPE, className);
        }

        Att type = atts.removeAtt(BASE_URI_STR, "type");
        if (null != type) {
            // rdf:type attribute, value is a URI-reference
            URIReference className = buildURIFromReference(type.getValue());
            reportStatement(nodeResource, RDF_TYPE, className);
        }

        if (verifyData) {
            checkRdfAtts(atts);
View Full Code Here

Examples of org.jrdf.graph.URIReference

        Iterator iter = atts.iterator();

        while (iter.hasNext()) {
            Att att = (Att) iter.next();
            URIReference predicate = createURIReference(att.getURI());
            Literal lit = createLiteral(att.getValue(), xmlLang, null);
            reportStatement(subject, predicate, lit);
        }
    }
View Full Code Here

Examples of org.jrdf.graph.URIReference

        if (verifyData) {
            checkPropertyEltName(namespaceURI, localName, qName);
        }

        // Get the URI of the property
        URIReference propURI;
        if ("".equals(namespaceURI)) {
            // no namespace URI
            sendError("unqualified property element <" + qName + "> not allowed");
            // Use base URI as namespace:
            propURI = buildResourceFromLocalName(localName);
        } else {
            propURI = createURIReference(namespaceURI + localName);
        }

        // List expansion rule
        if (propURI.equals(RDF_LI)) {
            NodeElement subject = (NodeElement) peekStack(0);
            propURI = createURIReference(BASE_URI_STR + "_" + subject.getNextLiCounter());
        }

        // Push the property on the stack.
        PropertyElement predicate = new PropertyElement(propURI);
        elementStack.push(predicate);

        // Check if property has a reification ID
        Att id = atts.removeAtt(BASE_URI_STR, "ID");
        if (null != id) {
            URIReference reifURI = buildURIFromID(id.getValue());
            predicate.setReificationURI(reifURI);
        }

        // Check for presence of rdf:parseType attribute
        Att parseType = atts.removeAtt(BASE_URI_STR, "parseType");

        if (null != parseType) {
            if (verifyData) {
                checkNoMoreAtts(atts);
            }

            String parseTypeValue = parseType.getValue();

            if ("Resource".equals(parseTypeValue)) {
                BlankNode objectResource = createBNode();
                NodeElement subject = (NodeElement) peekStack(1);

                reportStatement(subject.getResource(), propURI, objectResource);

                if (isEmptyElt) {
                    handleReification(objectResource);
                } else {
                    NodeElement object = new NodeElement(objectResource);
                    object.setIsVolatile(true);
                    elementStack.push(object);
                }
            } else if ("Collection".equals(parseTypeValue)) {
                if (isEmptyElt) {
                    NodeElement subject = (NodeElement) peekStack(1);
                    reportStatement(subject.getResource(), propURI, RDF_NIL);
                    handleReification(RDF_NIL);
                } else {
                    predicate.setParseCollection(true);
                }
            } else {
                // other parseType
                if (!"Literal".equals(parseTypeValue)) {
                    sendWarning("unknown parseType: " + parseType.getValue());
                }

                if (isEmptyElt) {
                    NodeElement subject = (NodeElement) peekStack(1);

                    Literal lit = createLiteral("", null, RDF.XML_LITERAL.toString());

                    reportStatement(subject.getResource(), propURI, lit);

                    handleReification(lit);
                } else {
                    // The next string is an rdf:XMLLiteral
                    predicate.setDatatype(RDF.XML_LITERAL.toString());
                    saxFilter.setParseLiteralMode();
                }
            }
        } else if (isEmptyElt) {
            // empty element without an rdf:parseType attribute
            if (0 == atts.size() || 1 == atts.size() && atts.getAtt(RDF.BASE_URI.toString(), "datatype") != null) {
                // element had no attributes, or only the optional rdf:ID
                NodeElement subject = (NodeElement) peekStack(1);
                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);
                }

                NodeElement resourceElt = new NodeElement(resourceRes);
                NodeElement subject = (NodeElement) peekStack(1);

                reportStatement(subject.getResource(), propURI, (ObjectNode) resourceRes);
                handleReification((ObjectNode) resourceRes);

                Att type = atts.removeAtt(BASE_URI_STR, "type");
                if (null != type) {
                    // rdf:type attribute, value is a URI-reference
                    URIReference className = buildURIFromReference(type.getValue());
                    reportStatement(resourceRes, RDF_TYPE, className);
                }

                processSubjectAtts(resourceElt, atts);
            }
View Full Code Here

Examples of org.jrdf.graph.URIReference

    private void handleReification(ObjectNode value) throws SAXException {
        PropertyElement predicate = (PropertyElement) peekStack(0);

        if (predicate.isReified()) {
            NodeElement subject = (NodeElement) peekStack(1);
            URIReference reifRes = predicate.getReificationURI();
            reifyStatement(reifRes, subject.getResource(), predicate.getURI(), value);
        }
    }
View Full Code Here

Examples of org.jrdf.graph.URIReference

    private URIReference addCommonTriples(DOReader reader, Set<Triple> set)
            throws ResourceIndexException {

        try {

            URIReference objURI = new SimpleURIReference(
                    new URI(PID.toURI(reader.GetObjectPID())));

            addCoreObjectTriples(reader, objURI, set);

            Datastream[] datastreams = reader.GetDatastreams(null, null);
View Full Code Here

Examples of org.jrdf.graph.URIReference

     */
    private void addCoreDatastreamTriples(Datastream ds,
                                          URIReference objURI,
                                          Set<Triple> set) throws Exception {

        URIReference dsURI = new SimpleURIReference(
                new URI(objURI.getURI().toString() + "/" + ds.DatastreamID));

        add(objURI, VIEW.DISSEMINATES, dsURI, set);

        URIReference dsDissType = new SimpleURIReference(
                new URI(FEDORA.uri + "*/" + ds.DatastreamID));

        add(dsURI, VIEW.DISSEMINATION_TYPE, dsDissType, set);

        boolean isVolatile =
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.