Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.Property


    }
   
    // <about:metadata:config:*> - The configuration parameters
    if (phPackage.equals("config")) {
      // look for requested property in the dataset config
      Property p  = getModel().createProperty(CONF.NS + phName);
      if (dataset.hasProperty(p))
        return dataset.getProperty(p).getObject();
     
      // find pointer to the global configuration set...
      StmtIterator it = dataset.getModel().listStatements(null, CONF.dataset, dataset);
      Statement ptrStmt = it.nextStatement();
      if (ptrStmt == null) return null;
     
      // look in global config if nothing found so far
      Resource globalConfig = ptrStmt.getSubject();
      if (globalConfig.hasProperty(p))
        return globalConfig.getProperty(p).getObject();
    }
   
    // <about:metadata:metadata:*> - The metadata provided by users
    if (phPackage.equals("metadata")) {
      // look for requested property in the dataset config
      Property p  = getModel().createProperty(META.NS + phName);
      if (dataset.hasProperty(p))
        return dataset.getProperty(p).getObject();
     
      // find pointer to the global configuration set...
      StmtIterator it = dataset.getModel().listStatements(null, CONF.dataset, dataset);
View Full Code Here


        new HashMap<String,PropertyBuilder>();
    StmtIterator it = resource.listProperties();
    while (it.hasNext()) {
      Statement stmt = it.nextStatement();
      if (isEmptyLiteral(stmt.getObject())) continue;
      Property predicate = stmt.getPredicate();
      String key = "=>" + predicate;
      if (!propertyBuilders.containsKey(key)) {
        propertyBuilders.put(key, new PropertyBuilder(
            predicate, false, config.getVocabularyStore()));
      }
      // TODO: Should distinguish clearly here between adding a
      //       simple value, adding a complex (inlined) value, and
      //       omitting a value. But how to decide whether blank nodes
      //       are omitted or included as complex value? The decision has
      //       already been made earlier when the model was built.
      propertyBuilders.get(key).addValue(stmt.getObject());
    }
    it = model.listStatements(null, null, resource);
    while (it.hasNext()) {
      Statement stmt = it.nextStatement();
      Property predicate = stmt.getPredicate();
      String key = "<=" + predicate;
      if (!propertyBuilders.containsKey(key)) {
        propertyBuilders.put(key, new PropertyBuilder(
            predicate, true, config.getVocabularyStore()));
      }
View Full Code Here

    StmtIterator it = isInverse
        ? model.listStatements(null, null, resource)
        : resource.listProperties();
    Map<Property, Integer> valueCounts = new HashMap<Property, Integer>();
    while (it.hasNext()) {
      Property p = it.next().getPredicate();
      if (!valueCounts.containsKey(p)) {
        valueCounts.put(p, 0);
      }
      valueCounts.put(p, valueCounts.get(p) + 1);
    }
View Full Code Here

   
    StmtIterator existingStmts = model.listStatements();
    while ( existingStmts.hasNext() ) {
      Statement o_stmt = existingStmts.nextStatement();
      Resource sbj = o_stmt.getSubject();
      Property prd = o_stmt.getPredicate();
      RDFNode obj = o_stmt.getObject();
     
      boolean any_change = false;
      Resource n_sbj = sbj;
      Property n_prd = prd;
      RDFNode  n_obj = obj;

//      if ( oldNameSpace.equals(sbj.getNameSpace()) ) {
      if ( _inNamespace(sbj, oldNameSpace) ) {
        n_sbj = model.createResource(newNameSpace + sbj.getLocalName());
View Full Code Here

      String value = JenaUtil2.getValue(ont_, dcProp);
     
      if ( value == null || value.trim().length() == 0 ) {
        // No. 
        // Then, take the value from the equivalent MMI attribute if defined:
        Property mmiProp = MdHelper.getEquivalentMmiProperty(dcProp);
        value = JenaUtil2.getValue(ont_, mmiProp);
       
        if ( value != null && value.trim().length() > 0 ) {
          // we have a value for DC from the equivalente MMI attr.
          if ( log.isDebugEnabled() ) {
View Full Code Here

      for (String[] fieldPropName : fieldPropNames ) {
        String propValue = user.get(fieldPropName[0]);
        if ( propValue == null || propValue.length() == 0 ) {
          continue;
        }
        Property propUri = model.createProperty( MMIORR_NS , fieldPropName[1] );
        if ( "hasDateCreated".equals(fieldPropName[1]) ) {
          model.add(userInstance, propUri, propValue,  XSDDatatype.XSDdateTime);
        }
        else {
          model.add(userInstance, propUri, propValue, XSDDatatype.XSDstring);
View Full Code Here

    //////////////////////////////////////////////////
    // transfer any preexisting attributes, and then remove all properties from
    // pre-existing ontRes so just the new OntModel gets added.
    if ( ontRes != null ) {
      for ( Statement st : prexistStatements ) {
        Property prd = st.getPredicate();

        //
        // Do not tranfer pre-existing/pre-assigned-above attributes
        //
        String newValue = newValues.get(prd.getURI());
        if ( newValue == null || newValue.trim().length() == 0 ) {
          // not assigned above.
         
          if ( ALTERATE_ANNOTATIONS ) {
            // See if it's one of the ones to be modified:
            if ( Omv.description.getURI().equals(prd.getURI()) ) {
              // transfer modified description:
              String description =
                "An unversioned ontology containing the latest terms as of the request time, " +
                "for the ontology containing: " +st.getObject();
//              log.info("  Transferring modified description: " +st.getSubject()+ " :: " +prd+ " :: " +description);
              newOntModel.add(ont_, st.getPredicate(), description);
            }
            else if ( Omv.name.getURI().equals(prd.getURI()) ) {
              // transfer modified title:
              String title =
                "Unversioned form of: " +st.getObject();
//              log.info("  Transferring modified title: " +st.getSubject()+ " :: " +prd+ " :: " +title);
              newOntModel.add(ont_, st.getPredicate(), title);
View Full Code Here

    // check all statements in the model:
    StmtIterator existingStmts = model.listStatements();
    while ( existingStmts.hasNext() ) {
      Statement o_stmt = existingStmts.nextStatement();
      Resource sbj = o_stmt.getSubject();
      Property prd = o_stmt.getPredicate();
      RDFNode obj = o_stmt.getObject();
     
      // will indicate that o_stmt is affected by the namespace change:
      boolean any_change = false;
     
      // the new triplet, initialized with the existing statement:
      Resource n_sbj = sbj;
      Property n_prd = prd;
      RDFNode  n_obj = obj;

      if ( oldNameSpace.equals(sbj.getNameSpace()) ) {
        // the subject is affected; create new subject
        n_sbj = model.createResource(newNameSpace + sbj.getLocalName());
View Full Code Here

    //////////////////////////////////////////////////
    // transfer any preexisting attributes, and then remove all properties from
    // pre-existing ontRes so just the new OntModel gets added.
    if ( ontRes != null ) {
      for ( Statement st : prexistStatements ) {
        Property prd = st.getPredicate();

        //
        // Do not tranfer pre-existing/pre-assigned-above attributes
        //
        String newValue = newValues.get(prd.getURI());
        if ( newValue == null || newValue.trim().length() == 0 ) {
          log.info("  Transferring: " +st.getSubject()+ " :: " +prd+ " :: " +st.getObject());
          newOntModel.add(ont_, prd, st.getObject());
        }
        else {
          log.info(" Removing pre-existing values for predicate: " +prd+ " because of new value " +newValue);
          newOntModel.removeAll(ont_, prd, null);
        }
      } 
     
     
      if ( ! createOntologyResult.isPreserveOriginalBaseNamespace() ) {
       
        //
        // Only, when we're creating a new model, ie., per the new namespace, do the following removals.
        // (If we did this on a model with the same original namespace, we would remove the owl:Ontology
        // entry altogether and get an "rdf:Description" instead.
        //
       
        log.info("Removing original OWL.Ontology individual");
        ontRes.removeProperties();
        // TODO the following may be unnecesary but doesn't hurt:
        model.remove(ontRes, RDF.type, OWL.Ontology);
      }
    }

   
   
    ///////////////////////////////////////////////////////
    // Update attributes in model:

    Map<String, Property> uriPropMap = MdHelper.getUriPropMap();
    for ( String uri : newValues.keySet() ) {
      String value = newValues.get(uri).trim();
      if ( value.length() > 0 ) {
        Property prop = uriPropMap.get(uri);
        if ( prop == null ) {
          log.info("No property found for uri='" +uri+ "'");
          continue;
        }
View Full Code Here

    //////////////////////////////////////////////////
    // transfer any preexisting attributes, and then remove all properties from
    // pre-existing ont so just the new OntModel gets added.
    if ( prexistStatements != null ) {
      for ( Statement st : prexistStatements ) {
        Property prd = st.getPredicate();

        //
        // Do not tranfer pre-existing/pre-assigned-above attributes
        //
        String newValue = newValues.get(prd.getURI());
        if ( newValue == null || newValue.trim().length() == 0 ) {
          if ( log.isDebugEnabled() ) {
            log.debug("  Transferring: " +st.getSubject()+ " :: " +prd+ " :: " +st.getObject());
          }
          newOntModel.add(ont_, prd, st.getObject());
        }
        else {
          if ( log.isDebugEnabled() ) {
            log.debug(" Removing pre-existing values for predicate: " +prd+ " because of new value " +newValue);
          }
          newOntModel.removeAll(ont_, prd, null);
        }
      } 
     
    }

   
   
    ///////////////////////////////////////////////////////
    // Update attributes in model:

    Map<String, Property> uriPropMap = MdHelper.getUriPropMap();
    for ( String uri : newValues.keySet() ) {
      String value = newValues.get(uri);
      if ( value != null && value.trim().length() > 0 ) {
        Property prop = uriPropMap.get(uri);
        if ( prop == null ) {
          log.info("No property found for uri='" +uri+ "'");
          continue;
        }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.Property

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.