<commit_before>/**
 * @file    object.h
 * @brief   SBOLObject class (a low-level, abstract class)
 * @author  <NAME>
 * @email   <EMAIL>
 *
 * <!--------------------------------------------------------------------------
 * This file is part of libSBOL.  Please visit http://sbolstandard.org for more
 * information about SBOL, and the latest version of libSBOL.
 *
 *  Copyright 2016 University of Washington, WA, USA
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, *
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ------------------------------------------------------------------------->*/

#ifndef OBJECT_INCLUDED
#define OBJECT_INCLUDED

#include "validation.h"
#include "properties.h"

#include <raptor2.h>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <unordered_map>

#if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3)
#include "Python.h"
#endif

namespace sbol
{
    
    
    /* All SBOLObjects have a pointer back to their Document.  This requires forward declaration of SBOL Document class here */
    class Document;
    
    /// An SBOLObject converts a C++ class data structure into an RDF triple store and contains methods for serializing and parsing RDF triples
    class SBOL_DECLSPEC SBOLObject
    {
        friend class Document;

        template < class LiteralType >
        friend class Property;
        
        template < class SBOLClass >
        friend class AliasedProperty;
    
    protected:
        /// @cond
        std::unordered_map<std::string, std::string> namespaces;
        void serialize(raptor_serializer* sbol_serializer, raptor_world *sbol_world = NULL);  // Convert an SBOL object into RDF triples
        std::string nest(std::string& rdfxml_buffer);  // Pretty-writer that converts flat RDF/XML into nested RDF/XML (ie, SBOL)
        std::string makeQName(std::string uri);
        std::vector<rdf_type> hidden_properties;  // Hidden properties will not be serialized
        
        /// @endcond

        /// Register an extension class and its namespace, so custom data can be embedded into and read from SBOL files
        /// @tparam ExtensionClass The new class
        /// @param ns The extension namespace, eg, http://myhome.org/my_extension#. It's important that the namespace ends in a forward-slash or hash
        /// @param ns_prefix A shorthand symbol for the full namespace as it will appear in the output file, eg, my_extension
        template < class ExtensionClass > void register_extension_class(std::string ns, std::string ns_prefix, std::string class_name);
        
    public:
        
        /// @cond
        Document *doc = NULL;
        rdf_type type;
        SBOLObject* parent;
        
        std::map<sbol::rdf_type, std::vector< std::string > > properties;
        std::map<sbol::rdf_type, std::vector< sbol::SBOLObject* > > owned_objects;
        /// @endcond
        
        /// The identity property is REQUIRED by all Identified objects and has a data type of URI. A given Identified object’s identity URI MUST be globally unique among all other identity URIs. The identity of a compliant SBOL object MUST begin with a URI prefix that maps to a domain over which the user has control. Namely, the user can guarantee uniqueness of identities within this domain.  For other best practices regarding URIs see Section 11.2 of the [SBOL specification doucment](http://sbolstandard.org/wp-content/uploads/2015/08/SBOLv2.0.1.pdf).
        URIProperty identity;<commit_msg>Initialized "parent" in member in object.h<commit_after>/**
 * @file    object.h
 * @brief   SBOLObject class (a low-level, abstract class)
 * @author  <NAME>
 * @email   <EMAIL>
 *
 * <!--------------------------------------------------------------------------
 * This file is part of libSBOL.  Please visit http://sbolstandard.org for more
 * information about SBOL, and the latest version of libSBOL.
 *
 *  Copyright 2016 University of Washington, WA, USA
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, *
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ------------------------------------------------------------------------->*/

#ifndef OBJECT_INCLUDED
#define OBJECT_INCLUDED

#include "validation.h"
#include "properties.h"

#include <raptor2.h>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <unordered_map>

#if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3)
#include "Python.h"
#endif

namespace sbol
{
    
    
    /* All SBOLObjects have a pointer back to their Document.  This requires forward declaration of SBOL Document class here */
    class Document;
    
    /// An SBOLObject converts a C++ class data structure into an RDF triple store and contains methods for serializing and parsing RDF triples
    class SBOL_DECLSPEC SBOLObject
    {
        friend class Document;

        template < class LiteralType >
        friend class Property;
        
        template < class SBOLClass >
        friend class AliasedProperty;
    
    protected:
        /// @cond
        std::unordered_map<std::string, std::string> namespaces;
        void serialize(raptor_serializer* sbol_serializer, raptor_world *sbol_world = NULL);  // Convert an SBOL object into RDF triples
        std::string nest(std::string& rdfxml_buffer);  // Pretty-writer that converts flat RDF/XML into nested RDF/XML (ie, SBOL)
        std::string makeQName(std::string uri);
        std::vector<rdf_type> hidden_properties;  // Hidden properties will not be serialized
        
        /// @endcond

        /// Register an extension class and its namespace, so custom data can be embedded into and read from SBOL files
        /// @tparam ExtensionClass The new class
        /// @param ns The extension namespace, eg, http://myhome.org/my_extension#. It's important that the namespace ends in a forward-slash or hash
        /// @param ns_prefix A shorthand symbol for the full namespace as it will appear in the output file, eg, my_extension
        template < class ExtensionClass > void register_extension_class(std::string ns, std::string ns_prefix, std::string class_name);
        
    public:
        
        /// @cond
        Document *doc = NULL;
        rdf_type type;
        SBOLObject* parent = NULL;
        
        std::map<sbol::rdf_type, std::vector< std::string > > properties;
        std::map<sbol::rdf_type, std::vector< sbol::SBOLObject* > > owned_objects;
        /// @endcond
        
        /// The identity property is REQUIRED by all Identified objects and has a data type of URI. A given Identified object’s identity URI MUST be globally unique among all other identity URIs. The identity of a compliant SBOL object MUST begin with a URI prefix that maps to a domain over which the user has control. Namely, the user can guarantee uniqueness of identities within this domain.  For other best practices regarding URIs see Section 11.2 of the [SBOL specification doucment](http://sbolstandard.org/wp-content/uploads/2015/08/SBOLv2.0.1.pdf).
        URIProperty identity;
{'fraction_non_alphanumeric': 0.1164366373902133, 'fraction_numerical': 0.005771643663739021, 'mean_word_length': 2.6988399071925753, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4892343', 'n_tokens_mistral': 2164, 'n_tokens_neox': 2097, 'n_words': 847}