Package org.openrdf.model.impl

Examples of org.openrdf.model.impl.GraphImpl


      // No need to record, starting from scratch anyway
      return;
    }

    if (this.newStatements == null) {
      this.newStatements = new GraphImpl();
    }
    this.newStatements.add(st);
  }
View Full Code Here


    if (this.statementsRemoved) {
      this.logger.debug("statements removed, starting inferencing from scratch");
      clearInferred();
      addAxiomStatements();

      this.newStatements = new GraphImpl();
      Iterations.addAll(getWrappedConnection().getStatements(null, null, null, true), this.newStatements);

      this.statementsRemoved = false;
    }
View Full Code Here

      // reset for next iteration:
      this.checkRuleNextIter[i] = false;
    }

    this.newThisIteration = this.newStatements;
    this.newStatements = new GraphImpl();
  }
View Full Code Here

            throws RepositoryException
        {
            if( entityState.entityDescriptor().queryable() )
            {
                final URI entityURI = stateSerializer.createEntityURI( getValueFactory(), entityState.identity() );
                Graph graph = new GraphImpl();
                stateSerializer.serialize( entityState, false, graph );
                connection.add( graph, entityURI );
            }
        }
View Full Code Here

    private SolrInputDocument indexEntityState( final EntityState entityState,
                                                final SolrServer server )
            throws IOException, SolrServerException, JSONException
    {
        Graph graph = new GraphImpl();
        stateSerializer.serialize( entityState, false, graph );

        SolrInputDocument input = new SolrInputDocument();
        input.addField( "id", entityState.identity().identity() );
        input.addField( "type", first(entityState.entityDescriptor().types()).getName() );
        input.addField( "lastModified", new Date( entityState.lastModified() ) );

        for( Statement statement : graph )
        {
            SchemaField field = indexedFields.get( statement.getPredicate().getLocalName() );
            if( field != null )
            {
                if( statement.getObject() instanceof Literal )
                {
                    String value = statement.getObject().stringValue();
                    if( field.getType().getTypeName().equals( "json" ) )
                    {
                        if( value.charAt( 0 ) == '[' )
                        {
                            JSONArray array = new JSONArray( value );
                            indexJson( input, array );
                        } else if( value.charAt( 0 ) == '{' )
                        {
                            JSONObject object = new JSONObject( value );
                            indexJson( input, object );
                        }
                    } else
                    {
                        input.addField( field.getName(), value );
                    }
                } else if( statement.getObject() instanceof URI && !"type".equals( field.getName() ) )
                {
                    String value = statement.getObject().stringValue();
                    value = value.substring( value.lastIndexOf( ':' ) + 1, value.length() );
                    String name = field.getName();
                    input.addField( name, value );
                } else if( statement.getObject() instanceof BNode )
                {
                    Iterator<Statement> seq = graph.match( (Resource) statement.getObject(), new URIImpl( "http://www.w3.org/1999/02/22-rdf-syntax-ns#li" ), null, (Resource) null );
                    while( seq.hasNext() )
                    {
                        Statement seqStatement = seq.next();
                        String value = seqStatement.getObject().stringValue();
                        value = value.substring( value.lastIndexOf( ':' ) + 1, value.length() );
View Full Code Here

    }

    public Iterable<Statement> serialize( final EntityState entityState,
                                          final boolean includeNonQueryable )
    {
        Graph graph = new GraphImpl();
        serialize( entityState, includeNonQueryable, graph );
        return graph;
    }
View Full Code Here

        dataTypes.put( LocalDate.class.getName(), XMLSchema.DATE );
    }

    public Iterable<Statement> serialize( final EntityDescriptor entityDescriptor )
    {
        Graph graph = new GraphImpl();
        ValueFactory values = graph.getValueFactory();
        URI entityTypeUri = values.createURI( Classes.toURI( first( entityDescriptor.types() ) ) );

        graph.add( entityTypeUri, Rdfs.TYPE, Rdfs.CLASS );
        graph.add( entityTypeUri, Rdfs.TYPE, OWL.CLASS );

        graph.add( entityTypeUri, Qi4jEntityType.TYPE, values.createLiteral( first( entityDescriptor.types() ).toString() ) );
        graph.add( entityTypeUri, Qi4jEntityType.QUERYABLE, values.createLiteral( entityDescriptor.queryable() ) );

        serializeMixinTypes( entityDescriptor, graph, entityTypeUri );

        serializePropertyTypes( entityDescriptor, graph, entityTypeUri );
        serializeAssociationTypes( entityDescriptor, graph, entityTypeUri );
View Full Code Here

public class ApplicationSerializer
{
    public Graph serialize( Application app )
    {
        Graph graph = new GraphImpl();
        SerializerContext context = new SerializerContext( graph );
        ApplicationVisitor applicationVisitor = new ApplicationVisitor( context );
        ( (Application) app ).descriptor().accept( applicationVisitor );
        return graph;
    }
View Full Code Here

      if (context == null) {
        throw new RepositoryException("No configuration context for repository " + repositoryID);
      }

      Graph contextGraph = new GraphImpl();
      con.getStatements(null, null, null, true, context).addTo(contextGraph);

      return RepositoryConfig.create(contextGraph, repositoryNode);
    }
    finally {
View Full Code Here

        context = vf.createBNode();
      }

      con.add(context, RDF.TYPE, REPOSITORY_CONTEXT);

      Graph graph = new GraphImpl(vf);
      config.export(graph);
      con.add(graph, context);
    }

    con.setAutoCommit(wasAutoCommit);
View Full Code Here

TOP

Related Classes of org.openrdf.model.impl.GraphImpl

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.